I'm not a guru on JS performance in QC, but here's my 2 cents...

Your first Javascript patch you're doing a lot of risky stuff such as typeof
and nested for loops.

Your second JS patch is doing more risky stuff.. like array slicing. These
can be notoriously slow operations depending on the JIT being used.

Keep in mind interpreted languages such as Javascript are at the mercy of
their JIT compilers and each one has its performance quirks when handling
things like loops and especially untyped operations (like typeof and untyped
array operations like slice).

You are also inputting and outputting entire structures, which may be slow
even with smaller lengths, depending on how QC passes these things in and
out of the JS.

One of the downsides to untyped languages like JS. You trade off performance
for easy syntax.

Jonathan


On Tue, Mar 1, 2011 at 12:15 AM, Alastair Leith <qc.student...@gmail.com>wrote:

> Hi Christopher,
>
>
>
>
>
>
> This example I have two JS patches. The first just flip-flops b/w two
> Arrays of n and n/2 elements. It only takes CPU when changing state.
>
> The second patch modifies it's output to match the length of the input
> Array. First it compares .length of the Arrays, if same do nothing.
>
> Although it's actually written if (a<b) {lose elements}; if (a>b) {add
> elements}, where a is input and b is internal JS array.
>
>
>
> So maybe some kind of if (a == b) break_statement(?); is required
>
> Anyhow without a Time input forcing execution every frame it runs 60fps
> even on my old box but with execution every frame it crawls to 5fps at n
> =2000
>
> Best
> Alastair
>
>
> *The machine does not isolate man from the great problems of nature but
> plunges him more deeply into them.**
> **Antoine de 
> Saint-Exupery*<http://www.brainyquote.com/quotes/quotes/a/antoinedes131176.html>
> * *
>
>
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Quartzcomposer-dev mailing list      (Quartzcomposer-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
>
> http://lists.apple.com/mailman/options/quartzcomposer-dev/jonathan.hart%40gmail.com
>
> This email sent to jonathan.h...@gmail.com
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      (Quartzcomposer-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to