Hey Jakob, 
the JS snippet that is executed every frame is the loop() function 
described 
here: https://github.com/kommander/cinderjs/blob/master/examples/lines.js.
The "for loop" variable "i" is defined every frame and I guess the number 
returned from the getRandomInt() function is allocated newly each call as 
well.
Not that much garbage though. Anyway, I found that the periodic frame rate 
decay every 2-4 seconds was because the v8 instance was running in the main 
thread with the Cinder App process.
Now that I do the rendering threaded, the periodic decay is almost gone. GC 
invocations can be seen with a lot of objects, where there is a little 
delay each second when drawing a lot
and doing time based animations. The animation gets really shuttery at some 
point. I am quite happy with the performance for now though.
Pointers to my wrong-doings in my way of binding v8 are appreciated.

Thanks!

Sebastian


On Monday, 20 October 2014 13:00:30 UTC+2, Jakob Kummerow wrote:
>
> Can you point me to the specific code that gets executed for every frame?
>
> Are you sure the frame drops you're seeing are caused by GC? Running with 
> --trace-gc would tell you how much time is spent in GC pauses. Since the GC 
> does most of its work incrementally, most pauses should be very short (even 
> in a 60 fps app -- that's pretty much what the GC is optimized for). 
> Another possible source of pauses is compilation, --trace-opt would 
> indicate that.
>
> If it is indeed GC activity, can you figure out what kind of objects are 
> being created and subsequently garbage collected? In many cases, it's 
> possible to write JS code such that it doesn't produce a lot of garbage.
>
> Maybe someone else on this list has additional tips; I don't have personal 
> experience embedding V8.
>
>
> On Sat, Oct 18, 2014 at 7:50 PM, Sebastian Herrlinger <[email protected] 
> <javascript:>> wrote:
>
>> Using the latest master branch of v8 I am trying to bring some scripting 
>> together with http://libcinder.org/ in an Cocoa App.
>> Works fine so far and I can happily draw from javascript and control 
>> component behaviour.
>>
>> As the cinder app runs at 60 fps, the GL methods bindings get called very 
>> often, which apparently creates a lot of garbage to collect.
>> The frame rate drops up to 20 fps when the garbage collection kicks in. I 
>> initialise v8 in the main thread together with Cinder. 
>>
>> Is there a design concept that lets me optimise this GC behaviour to work 
>> around frame rate drops?
>> Using multiple contexts and switching for example? Has anybody experience 
>> with Javascript and render loops?
>>
>> Best regards,
>>
>> Sebastian
>>
>>
>> PS: Stitched together Cinder + v8 here: 
>> https://github.com/kommander/cinderjs
>>
>> -- 
>> -- 
>> v8-users mailing list
>> [email protected] <javascript:>
>> http://groups.google.com/group/v8-users
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "v8-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to