lib size increasing a lot since 8.3

142 views
Skip to first unread message

MG

unread,
Dec 21, 2021, 4:21:55 AM12/21/21
to v8-users
We have been building v8 for android since 8.3. We use `is_component_build` to only add in our lib the modules we need for our engine (i am talking about the engine behind Nativescript ) In 8.3 the resulting libv8 was 50Mb. In 9.3 it went to 66.3Mb and now in 9.7 we are at 68.2Mb It is a bit worrying to see such a lib size increase over that period.
Wondering if we could get some understanding of this, and maybe some advices on how to keep it "small"

Camillo Bruni

unread,
Jan 11, 2022, 9:05:05 AM1/11/22
to v8-u...@googlegroups.com
Hi,

Yes binary size is a concern on our end as well (for instance shipping chrome on android).
Looking at our own numbers we see roughly a 10% increase per year, partly due to optimisations and partly due to new features being added to the language.

You could potentially disable parts of V8 and save on binary size, typically they revolve around profiling and debugging.
That might work if you have minimal release builds, where let's say you disable the profiler and the inspector (or even certain web-features like wasm).

In short, there is no easy way to greatly reduce binary size without sacrificing features at the moment.

cheers,
Camillo

On Tue, 21 Dec 2021 at 10:22, MG <martin....@akylas.fr> wrote:
We have been building v8 for android since 8.3. We use `is_component_build` to only add in our lib the modules we need for our engine (i am talking about the engine behind Nativescript ) In 8.3 the resulting libv8 was 50Mb. In 9.3 it went to 66.3Mb and now in 9.7 we are at 68.2Mb It is a bit worrying to see such a lib size increase over that period.
Wondering if we could get some understanding of this, and maybe some advices on how to keep it "small"

--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups "v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-users/aca44c98-f816-4a2b-9502-7a7d64dfd3fcn%40googlegroups.com.
Camillo Bruni | Software Engineer, V8 | Google Germany GmbH | Erika-Mann Str. 33, 80636 München 

Registergericht und -nummer: Hamburg, HRB 86891 | Sitz der Gesellschaft: Hamburg | Geschäftsführer: Paul Manicle, Halimah DeLaine Prado

Diese E-Mail ist vertraulich. Falls Ssie diese fälschlicherweise erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich bitte wissen, dass die E-Mail an die falsche Person gesendet wurde.  This e-mail is confidential. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it has gone to the wrong person.

MG

unread,
Jan 11, 2022, 9:25:49 AM1/11/22
to v8-users
Thanks Camillo for taking the time to answer this

Very interesting to know you follow this too and knowing you expect a 10% increase per year is a good indicator for to see what s happening.

First to put this into context. I am part of the Nativescript community. We are using v8 as a Javascript engine for cross platform mobile applications.

We compile v8 then we compile a .so lib which is used inside apps.
That so lib went from 14.2Mb with v8 8.3 to 17.6Mb with v8 9.7
Which means 20% increase i a year and an half. We are not so far from what you explain.

Now maybe you can help us see if we build optimized enough builds of v8.
When building v8 we actually build only `v8_compiler v8_base_without_compiler v8_libplatform v8_snapshot v8_libbase v8_bigint torque_generated_initializers torque_generated_definitions` Then we create our v8 lib with all the .o of those modules.
Here is the build script we use
Here are the build flags we use
`use_goma=false is_clang=true enable_resource_allowlist_generation=false is_component_build=true v8_use_external_startup_data=false is_official_build=true use_thin_lto=false is_debug=false symbol_level=0 v8_enable_i18n_support=false target_os=\"android\" v8_android_log_stdout=false use_custom_libcxx=true cc_wrapper=\"ccache\"`

Do you think we could improve it in any way? is there any .o we can filter from those modules?

Camillo Bruni

unread,
Feb 15, 2022, 9:28:44 AM2/15/22
to v8-u...@googlegroups.com
On Tue, 11 Jan 2022 at 15:25, MG <martin....@akylas.fr> wrote:
Thanks Camillo for taking the time to answer this

Very interesting to know you follow this too and knowing you expect a 10% increase per year is a good indicator for to see what s happening.

First to put this into context. I am part of the Nativescript community. We are using v8 as a Javascript engine for cross platform mobile applications.

We compile v8 then we compile a .so lib which is used inside apps.
That so lib went from 14.2Mb with v8 8.3 to 17.6Mb with v8 9.7
Which means 20% increase i a year and an half. We are not so far from what you explain.

Now maybe you can help us see if we build optimized enough builds of v8.
When building v8 we actually build only `v8_compiler v8_base_without_compiler v8_libplatform v8_snapshot v8_libbase v8_bigint torque_generated_initializers torque_generated_definitions` Then we create our v8 lib with all the .o of those modules.
Here is the build script we use
Here are the build flags we use
`use_goma=false is_clang=true enable_resource_allowlist_generation=false is_component_build=true v8_use_external_startup_data=false is_official_build=true use_thin_lto=false is_debug=false symbol_level=0 v8_enable_i18n_support=false target_os=\"android\" v8_android_log_stdout=false use_custom_libcxx=true cc_wrapper=\"ccache\"`

Do you think we could improve it in any way? is there any .o we can filter from those modules?

If you're willing to hack a bit more:
- Disable "v8_enable_runtime_call_stats = false" (this has changed recently on the main branch and it's disabled by default) (~250 KB)
- Disable webassembly if you're certain you don't need it: "v8_enable_webassembly = false" (~0.9Mb)

More hacky things:
- Strip away all builtins in runtime-test.cc (~70KB)
- Remove debugger support (~150KB)
- Don't ship profiler / inspector if not needed (currently there is no flag for this) (~0.5Mb)

Reply all
Reply to author
Forward
0 new messages