Live data from Hacker News

I made JSON.parse() 2x faster

radex.io

1–10 of 15 posts

Re: I made JSON.parse() 2x faster

#5

This is a great blog post with few comments. Impressive work. Did they merge it?

Thanks! There's a preliminary PR with a discussion here: https://github.com/facebook/hermes/pull/933 (and broader context here: https://github.com/facebook/hermes/issues/811 ). But we'll see if there's any interest on Hermes' side to merging it. They definitely want to improve the parser, but it's unclear to me if they want to take on the simdjson/simdutf dependencies.

Re: I made JSON.parse() 2x faster

#9
This is delightful!

Maybe next you can make the object spread operator faster ;). I was recently bitten by it in a hot loop, thinking it was generally syntactic sugar. Turns out that if I know all the property names in an object, it’s far far faster to just assign them all manually.

Re: I made JSON.parse() 2x faster

#10

This is delightful! Maybe next you can make the object spread operator faster ;). I was recently bitten by it in a hot loop, thinking it was generally syntactic sugar. Turns out that if I know all the property names in an object, it’s far far faster to just assign them all manually.

That could be interesting! Curious: are you taking about a plain object spread, or are you talking about JSX spreads? The latter has more overhead. Also, which JS engine?

BTW. I recently measured the spread operator in a microbenchmark. Interestingly, while the native spread was faster on Hermes and JSC, it was slower on V8/Chrome, and it's faster there to use `Object.assign()`, i.e.:

['@babel/plugin-proposal-object-rest-spread', { loose: true, useBuiltIns: true }]

Post reply on HN