croteaucarine / simdjson_node_objectwrap

Node bindings for the simdjson project
16 stars 4 forks source link

Need to change some API #3

Open dalisoft opened 4 years ago

dalisoft commented 4 years ago

Hi @croteaucarine

I think would be nice to implement ease-of-use API with performance of simdjson, like i'm did ease-of-use Express.js and Performance of uWebSockets.js (my library called nanoexpress)

I like this API:

SJNO - SimdJSON Node.js Object-Wrap

  1. Loading json - SJNO.load(jsonFile), performance should be fast even for first run
  2. Parse json - SJNO.parse(jsonString), performance should be fast even for first run
  3. Stringify json - SJNO.stringify(RAWObject), performance of this func also matters
  4. [Optional, but very needed feature] Validate - SJNO.validate(jsonString | RAWJSObject, SCHEMA)
  5. [Optional, but very needed feature] Schema - SJNO.parse(jsonString, SCHEMA) or this way improves performance also may be SJNO.validate(schema).parse(jsonString) or SJNO.validate(schema).stringify(jsonString)
dalisoft commented 4 years ago

Also, new construct somewhere may slowdown repeated functions and V8 does not optimize function as this is native bindings (C/C++) calls