Why is Json parsing slower in multiple threads?

Alexandre Bourquelot alexandre.bourquelot at ahrefs.com
Thu Jun 22 03:20:44 UTC 2023


On Wednesday, 21 June 2023 at 00:35:42 UTC, Steven Schveighoffer 
wrote:
> The issue, undoubtedly, is memory allocation. Your JSON parsers 
> (both std.json and vibe-d) allocate an AA for each object, and 
> parse the entire string into a DOM structure. The D GC has a 
> single global lock to allocate memory -- even memory that might 
> be on a free list. So the threads are all bottlenecked on 
> waiting their turn for the lock.

This makes a lot of sense. I ended up using asdf and it works 
great.

Thank you everyone for your insight.




More information about the Digitalmars-d mailing list