caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Daniel Bünzli" <daniel.buenzli@erratique.ch>
To: becker.nils@gmx.net
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] using React for -- reactions
Date: Tue, 19 Aug 2014 13:27:27 +0100	[thread overview]
Message-ID: <1B358C457E1445C0A76B9491809C4C6D@erratique.ch> (raw)
In-Reply-To: <sympa.1408436986.28320.956@inria.fr>

Le mardi, 19 août 2014 à 09:34, becker.nils@gmx.net a écrit :
> is there a run-time cost for large dependency graphs?

The runtime cost is depends on the topology of the graph rather than its largeness. Basically given a primitive event/signal update you need in the worst case to do a topological sort of its recursive dependencies on each update step. But that's really the worst case, as for example if a signal doesn't change its value in the step it's dependents are not updated.  

> reactions are relatively sparse, ie. the number of reactions R=O(N),
> where N could be from 1e1 to 1e4 or so. so, in each update step only a
> small number <10 of dependent molecule numbers and waiting times need to
> be updated, even for large systems. in other words, the React-managed
> dependency graph is wide (N) but not tall (relatively short dependecy
> chains, see above),

If it's wide at the *primitive* level then this is a good property for performance since an update will have little needless work to do. If it is wide just *after* the primitive for no good reason, i.e. single primitive with huge number of dependents that filter the primitive and then short dependencies, you may want to express the first level of dependents as a primitive if the filtering nodes entails that only a few of them trigger on an update. That is sometimes you can gain performance by putting more logic/transformation in your primitives, as it allows you to cut down on the number of nodes or needless updates.

> bottom line: can a React based simulation possibly compete with manual,
> in-place update of arrays, let's say within a factor of 2? if yes what
> do i need to pay attention to?

No idea. Basically you need to pay attention to the topology of your graph. Is your code published somewhere ?  

Best,

Daniel

  reply	other threads:[~2014-08-19 12:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-19  8:34 becker.nils
2014-08-19 12:27 ` Daniel Bünzli [this message]
2014-08-19 13:13   ` Nils Becker
2014-08-20  9:11   ` Nils Becker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1B358C457E1445C0A76B9491809C4C6D@erratique.ch \
    --to=daniel.buenzli@erratique.ch \
    --cc=becker.nils@gmx.net \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).