digitalbazaar / jsonld.js

A JSON-LD Processor and API implementation in JavaScript
https://json-ld.org/
Other
1.66k stars 195 forks source link

isKeyword optimization for non-keyword fast path. #356

Closed davidlehn closed 4 years ago

davidlehn commented 4 years ago

I tried various permutations of other isKeyword optimizations. The benchmarking code had too much noise to tell what was best. But this simple change does appear to have some effect for some (most?) workloads. I did try a few other things, which should maybe be further explored if needed, but I couldn't tell if they were better or not:

If someone wants to dig into the optimizer to figure out the best way to run this particular check, that could be interesting. I think better benchmarking code is needed to check otherwise.