feat: Add option for native js implementation of jq#2233
feat: Add option for native js implementation of jq#2233W-Floyd wants to merge 1 commit intogchq:masterfrom
Conversation
|
Note that the native JS implementation is still much faster. Passing 5MB.json through |
|
I think we should make a decision to either use WASM or JS based JQ rather than providing a choice to users. The functionality of JQ would presumably be the same either way, so I can't see it being a useful a choice for users. If we give them the choice, we will then have to maintain a more complicated operation with two different dependencies. |
|
I concur that we only want a single jq implementation, and based on #2232 and the results above it looks like that should be jq-web @W-Floyd - you stated above "We should not replace the WASM version yet, as the JS version is not at full parity" - could you expand on that at all? What's missing/different in the jq-web version? |
|
Sure, per https://github.com/mwh/jqjs:
It also includes a list of language features implemented/not yet implemented. For most use cases I'm guessing this will work, but it may cause a regression for more advanced queries. |
|
Closing as, for now, we have reverted to jq-web instead. However thanks for your effort on this and the original #2223 - it's much appreciated even if we eventually took a different route (partly influenced by the results of your research). |
|
No problem, thanks for getting things reverted! 😅 |
Testing solutions to #2232
Performance with WASM jq can be slow for some reason (I should also investigate).
For example, running
lengthon 512KB.json takes ~12000ms using WASM.Using native JS, the same operation takes 5ms
Note that using a smaller input takes less time. E.g 64KB.json takes ~250ms with WASM, but 2ms with native JS.
We should not replace the WASM version yet, as the JS version is not at full parity.