Skip to content
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

Reduce code size of node #19

Closed
cuttlfish opened this issue Oct 23, 2015 · 8 comments
Closed

Reduce code size of node #19

cuttlfish opened this issue Oct 23, 2015 · 8 comments
Labels

Comments

@cuttlfish
Copy link

Hi,

Is there any way to reduce the code size of nodejs. On a cross compile platform it comes to be about 9 MB.

Also is there a way to reduce initial heap allocated by V8

Thanks
David

@mikeal
Copy link

mikeal commented Oct 23, 2015

pinging @trevnorris since he likely knows the answer.

@trevnorris
Copy link

By code size do you mean the built binary? As for v8, there are ways to constrain how much maximum memory it can use, but don't know of a way to limit memory consumption at startup.

@cuttlfish
Copy link
Author

Hi Trevor,

Yes I mean the built binary. I tried changing the v8 gcc flag to -Os, that
did succeed in making it smaller, but starts up slower I guess due to less
optimization

David

On Fri, Oct 23, 2015 at 11:41 AM, Trevor Norris notifications@github.com
wrote:

By code size do you mean the built binary? As for v8, there are ways to
constrain how much maximum memory it can use, but don't know of a way to
limit memory consumption at startup.


Reply to this email directly or view it on GitHub
#19 (comment).

@trevnorris
Copy link

I'm not really sure. you could compile w/o openssl if you don't need crypto.

@srl295
Copy link
Member

srl295 commented Dec 10, 2015

@cuttlfish what operating system and platform?

@cuttlfish
Copy link
Author

This is linux running on a ARM platform that is similar to raspberry pi

On Wed, Dec 9, 2015 at 5:06 PM, Steven R. Loomis notifications@github.com
wrote:

@cuttlfish https://github.com/cuttlfish what operating system and
platform?


Reply to this email directly or view it on GitHub
#19 (comment).

@amulpatel
Copy link

I am also looking to reduce node memory size around 20 MB in openwrt. currently it is consuming around 50 MB.

is there any way to reduce memory consumption ? even i am ready to change code to reduce memory i.e v8, uv or other deps.

Thanks,
Amul Patel

@bnoordhuis
Copy link
Member

There is an --optimize_for_size flag in newer versions of node and you can limit the size of the heap with --max_old_space_size=... (and --max_semi_space_size and --max_executable_size) in all versions.

You can also tweak common.gypi to build at -Os instead of -O3. The smaller binary, besides using less memory, also tends to run faster on systems with small L1 code caches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants