{"id":20145944,"url":"https://github.com/usagi/neon-vs-node-ffi-napi","last_synced_at":"2025-07-14T13:09:24.270Z","repository":{"id":143043682,"uuid":"251405646","full_name":"usagi/neon-vs-node-ffi-napi","owner":"usagi","description":"Benchmark: NEON vs. node-ffi-napi vs. pure Node.js","archived":false,"fork":false,"pushed_at":"2020-03-30T20:57:23.000Z","size":24,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-03T00:14:26.646Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/usagi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-30T19:19:10.000Z","updated_at":"2022-10-20T14:51:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"daa2282f-c432-4462-ba38-0d0e6e0d777a","html_url":"https://github.com/usagi/neon-vs-node-ffi-napi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/usagi/neon-vs-node-ffi-napi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usagi%2Fneon-vs-node-ffi-napi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usagi%2Fneon-vs-node-ffi-napi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usagi%2Fneon-vs-node-ffi-napi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usagi%2Fneon-vs-node-ffi-napi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/usagi","download_url":"https://codeload.github.com/usagi/neon-vs-node-ffi-napi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usagi%2Fneon-vs-node-ffi-napi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265297044,"owners_count":23742585,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T22:18:49.415Z","updated_at":"2025-07-14T13:09:24.238Z","avatar_url":"https://github.com/usagi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# neon-vs-node-ffi-napi\n\nThis is a benchmark project of `NEON` vs. `node-ffi-napi` vs. pure-`Node.js`. It's focused to a marshalling cost.\n\n1. The \"pure\" is: `Node.js` ↺ `Node.js`\n2. The \"NEON\" is: `Node.js` ⇄ `NEON` ⇄ `native code`\n3. The \"node-ffi-napi\" is: `Node.js` ⇄ `node-ffi-napi` ⇄ `native code`\n\n## Usage\n\n```sh\ngit clone git@github.com:usagi/neon-vs-node-ffi-napi.git\ncd neon-vs-node-ffi-napi\nyarn start\n```\n\n## A result\n\n|        | pure        | NEON        | node-ffi-napi |\n| ------ | ----------- | ----------- | ------------- |\n| empty  | 47.92550206 | 128.3124983 | 5800.287876   |\n| rng    | 35.47475487 | 175.1873791 | 5176.462751   |\n| buffer | 175394.375  | 534.950003  | 59332.4       |\n\nUnit: `[ns/function-call]`; See also \"Main codes\" section.\n\nThere are two important points these are the marshalling cost comparison and the useful usage. These individual values are not important.\n\n1. You may not need a native codes and a marshallings if you want to use only lightweight implements. Maybe, a marshalling cost be over than native code advantage.\n2. You should use `NEON` if you want speedup mainly with a native code. Unfortunately, `node-ffi-napi` is so slow.\n3. You may need a native code and a marshallings if you need to operate buffers such as `ArrayBuffer`.\n\nNote: This result scored in 2020-03-31. Using Threadripper 2990WX machine.\n\n## Main codes\n\n- [index.js](index.js) ... Benchmarking code, pure `Node.js` implements, `node-ffi-napi` marshalling part.\n- [native/src/lib.rs](native/src/lib.rs) ... `NEON` marshalling part.\n- [workspace.rs/backend/src/lib.rs](workspace.rs/backend/src/lib.rs) ... backend pure `Rust` implements.\n\n## License\n\nMIT\n\n## Author\n\nUSAGI.NETWORK / Usagi Ito \u003chttps://usagi.network/\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusagi%2Fneon-vs-node-ffi-napi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fusagi%2Fneon-vs-node-ffi-napi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusagi%2Fneon-vs-node-ffi-napi/lists"}