-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node.js 14 can't build bindings #5720
Comments
You won't be able to use the node bindings with node > 8 until someone puts some work into the bindings layer so it works with the new C++ interface that shipped with node 10+. |
Thanks! Are the required changes to these files? Also, do you know how the performance compares between the HTTP interface and the Node.js bindings? If it's not a big hit, I can live with the HTTP interface. |
The performance is a bit dependent on what you want to do. If you're working with large responses with a very large JSON response size (i.e. large The HTTP interfaces with |
Yeah, I'm going to be using the table service exclusively in a one to many configuration, so ~10000 routes each request. Very interesting though. What scenarios is the HTTP interface faster than the Node.js binding? I imagined Node.js binding would be faster in all scenarios. I figured using the HTTP interface internally only would be wasteful, but seems not? I also thought that with URL length limitations, it would be impossible to pass 10000 points? |
The |
Fantastic! Thanks for the headsup. For anyone else reading this thread: Node.js has a default limit of 8kB Do you have any benchmarks on Node.js bindings vs HTTP interface? |
Not on hand, but you can perform your own easily enough. I re-implemented most of but we never got around to shipping that. I think it should still work, as long as you use Node 8. For big requests, using HTTP POST would be an option if you're using Node - you don't have to be bound by the default max header size (although it is also adjustable with a command-line switch). The big difference between There are some known edge cases using Node where things might slow down - particularly requests with many small JSON objects in the response (i.e. large matrices with millions of entries) - the C++<-> NodeJS bridge tends to be a bottleneck here, as all those objects have to be created synchronously on the primary Node thread, which tends to block the event loop. Over in 0971f06#diff-71b29364088b4fbed3f8557b631291ef I added a |
@danpat is that N-API? Trying to research a bit what it would take to make the project compatible with the latest Node. Thanks |
Yes. OSRM is currently using I can see that |
@danpat I played with this tool a bit and it seems to convert the code accordingly. Unfortunately I don't have knowledge of building binary node packages. I tried playing around with the cmake config in order to get it to include the new Do you think with your (or some maintainer's) knowledge it might be an easy/quick conversion using that script I linked? Thanks |
🤷 I mean, it's probably a couple of hours work to mechanically convert everything over. Finding a couple of hours to do that on the other hand..... |
@danpat I'm a bit confused about the build step. I see osrm builds the node bindings through the CMake flow. All the N-API tutorials I found online point to using My issue is not with the mechanical conversion but with setting up the build system. |
@mihneadb They can be built either way. If you do You can also do I don't think you'd need to modify the build system at all - as long as |
I needed to manually add an include path for the new @danpat hopefully pre-applying that script can cut down on those 2 hours :). This is what the script changed, in case it helps: master...mihneadb:napi |
@danpat I believe using N-API one should hook into libosrm to reimplement node-osrm. Do you have an opinion? |
Fixed in #5918, released with v5.24. |
Like this #5667, I'm unable to build the Node.js binding. I'm able to build the project fine though. (osrm-extract, osrm-contract, osrm-routed works fine)
Linux x64, gcc 9.3.0, debian 10.
That said, how am I supposed to use this module with my Node.js project? What happens afternpm install --build-from-source
? How do I reference this custom built module in my project'spackage.json
? Is it intended to be a git submodule?https://stackoverflow.com/q/30249234
The text was updated successfully, but these errors were encountered: