Hacker News new | past | comments | ask | show | jobs | submit login

To the author of this article: Could you run your node test with "node --trace-gc <script>" turned on? That will output when, and for how long, node's GC is doing it's thing.

Anyway, this could be a legit complaint at this point.




--trace-gc will show an endless sequence of mark-sweep/compacts.

I explained why that happens in my comment to the original post.


Great comment! Anybody interested should check it out: http://hns.github.com/2010/09/29/benchmark2.html#comment-820...


It explains why JSON parsing doesn't perform well, but doesn't explain the original benchmark results. Would be great to get a comment from @mraleph or the other V8 guys on that.


Speaking about GC behavior of other benchmarks:

1) one with Buffers is also causing mark-sweep/compact pauses (7-15ms each) because Buffer constructor calls AdjustAmountOfExternalAllocatedMemory which triggers full gc cycle if it thinks that too much memory is held outside V8.

2) GCs in string based benchmark are mainly scavenges taking 0 ms plus < 10 full collections taking <6ms each on my desktop.

That is all I can say. V8 GC is performing well here from my point of view.


I just found out the same. So I guess it must be some intra-VM data shifting? Anyway, I'll update my posting accordingly.


I don't know node.js well enough to even make a guess here. Somebody needs to profile it.

Updating your post sounds like a nice idea. It created a lot of confusion among developers.


Updated!


Yes, --trace-gc shows about 10 Mark-sweeps per second, each taking around 13 ms (no compacts though as far as I could see). But are those ~15% spent in GC are enough to explain the performance?


You were saying that V8 GC is failing here so I just explained why JSON.parse is especially bad for V8 GC.

Strictly speaking I am not even convinced that GC is bottleneck here. Only profiling can reveal the real bottleneck.

[I tried small experiment: used thirdparty pure-JS JSON parser instead of V8 JSON.parse --- that changed GC profile, but did not affect response time.]




Applications are open for YC Summer 2023

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: