On Wednesday, May 15, 2019 at 9:09:18 PM UTC+2, Ledion Bitincka wrote:
>
> Thanks! 
>
> > While I understand that this is tempting, please be aware that only one 
> thread may be active in one Isolate at any given time.
> I was hoping that there could be multiple threads that had "read-only" 
> access to an Isolate's heap - I was looking through how ValueSerializer works 
> and now I understand there's no such thing as "read-only" given the 
> getter/setter functions. However, wondering if this would be possible for 
> simple objects (key/value) and bail for more complex ones. Any other 
> suggestions for how that work can be parallelized, is it even possible? 
> (this is custom serialization, not JSON)
>
>>
>> You could read from the heap on a concurrent thread but there is no 
synchronization when writing to the heap from the main thread, so there's 
no guarantee that what you are reading is not being concurrently written 
e.g. when it is being allocated, when it is modified by user JS code or 
when the GC moves it.

If the serialization work itself was particularly expensive (e.g. the 
format is very complicated or the data requires a lot of processing) then 
you could copy the relevant parts of the heap objects off-heap and then 
serialize from concurrent threads.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
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 v8-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/910c73d5-4071-4ddf-8e63-6e896a777c46%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to