You might find this interesting. I tried setting preemption time to 10ms and output of my script was sporadic (in bursts). I set it to 1ms and it got way better. I set it to 0ms and it seems perfect.
I'm not sure what kind of performance impact this setting has. On Jul 2, 2012, at 10:52 AM, Pablo Sole wrote: > > On 07/02/2012 01:00 PM, Michael Schwartz wrote: >> Wow, that's a great tip. I implemented it and long running threads work >> fine and get preempted. > Glad to help! >> I guess the disadvantage is thread safety and synchronization of data >> accesses. I'm not clear on when a thread running in v8 might be preempted. >> Likely on entering or exiting functions (when doing stack checks, I think I >> remember reading about). > AFAIK, any StackGuard instance is preemptible, regex matching also check > for preemption, some loops and there must be some other places too. This > mechanism is used by chromium, I suppose, to switch between Contexts > (frames/iframes) of a same tab (Isolate?). I'm completely making this up > and it's probably not accurate, but must be something like that :). > > The rule of thumb for thread safety should be to not trust on a Locker > instance (which can be preempted) for any resource sync managed or > potentially modified from outside of v8. A C++ function wrapped inside a > FunctionTemplate though, cannot be preempted of course, so that's safe. > > pablo. > > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
