Thanks for the suggestions!

I tried duplicating json-stringifier.cc but ran quickly into the fact that 
it uses v8::internal stuff which isn't exposed in the v8 public API, and 
therefore not exposed in Node's plugin APIs either. So, I implemented on 
top of v8::Object::GetPropertyNames() instead. Thus far, my implementation 
is 3x slower than the built-in one: together v8::Object::GetPropertyNames() 
and v8::Object::Get() eat up two thirds of the time. The internal 
implementation is able to use IterateOwnDescriptors(), which seems much 
faster (and doesn't allocate an array of keys).

-- Philip

On Thursday, January 6, 2022 at 6:48:17 AM UTC-8 ja...@mogill.com wrote:

> Hi Phillip,
>
> When faced with a similar situation we were concerned with startup/restore 
> efficiency of parsing all that JSON every time the program was run, we 
> concluded a lazy evaluation strategy worked best for us and we decomposed 
> the object for serialization & storage, later it was reconstituted when 
> referenced.  Your additional step of compression would complicate this, but 
> the basic idea holds.
>
> If you really need a monolithic snapshot, your plan of implementing your 
> own based on existing deep-copy and stringify code is probably your least 
> surprise-free permanent solution.  If you publish it you may discover 
> you're not the only one reading and writing large JSON objects.
>
> However, if it is possible to leverage your knowledge of the data to 
> decompose it for serialization, a small amount of JS to paper over the 
> decomposition may be all you need.
>
>             -J
>
>

-- 
-- 
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/cd49ac74-cdf0-4599-a8d5-8a0993f68340n%40googlegroups.com.

Reply via email to