mapbox / node-or-tools

Node.js bindings for or-tools vehicle routing problems
MIT License
146 stars 48 forks source link

Size too large for deployment. Possibilities to reduce size? #71

Open bradyhigginbotham opened 4 years ago

bradyhigginbotham commented 4 years ago

Hey, guys. Thanks for making a great library. I'm getting beautifully optimized routes!

My issue revolves around the resulting library size. Pulling from npm, this library comes in at a chunk of 475 MB, and it looks like the biggest piece is libtools.a @ 317 MB.

Is there any way I can reduce this size? We were really hoping to use this in a Lambda function to build optimal routes for our fleet, but the Lambda max is 250 MB. Is there another version of libtools.a or node-or-tools in general that's a bit slimmer?

Thanks a lot for any help!

Edit: Using --build-from-source doesn't work either if it helps.

bradyhigginbotham commented 4 years ago

Update to this:

I ended up removing the mason_packages folder in post install. It greatly reduced the size down to about 25 MB and still seems to function just fine. I'm sure I'm missing a binary or something somewhere that's available at the lower size, but this is currently working.

Edit: I'm not closing mainly because my solution is a workaround, and I believe a better one is possible. 😄