On Fri, Feb 16, 2018 at 5:09 PM, Chris Dumoulin <crdum...@gmail.com> wrote:

> Thanks for the reply Jakob. I'll give your code changes a try.
> I'm currently trying this on Mac OS X x64.
>
> I'm pretty sure I'm using a snapshot build. Is there an easy way to tell
> for sure?
>

Snapshot builds are the default if you're building with gn (it's the
`v8_use_snapshot` flag).
You can always verify by moving snapshot_blob.bin and running
v8_hello_world, which should now crash.


> Do you have any idea why Massif wouldn't show a memory decrease?
>

Sorry, I'm not familiar with Massif and how it measures memory usage. It'd
be interesting to find out more though.


> How was the memory measured for the blog post on lazy deserialization?
>

The reported numbers are from this counter:
memory:chrome:renderer_processes:reported_by_chrome:v8:heap:effective_size

See e.g.:
https://chromeperf.appspot.com/report?sid=5a61019415f14d0e08769209248a634be258c1a6b740fbe876911dd13b6d8731

The blog post shows the difference in this counter after sites with &
without lazy deserialization.


>
> On Friday, 16 February 2018 03:49:24 UTC-5, Jakob Gruber wrote:
>
>> On Thu, Feb 15, 2018 at 9:28 PM, Chris Dumoulin <crdu...@gmail.com>
>> wrote:
>>
>>> I'm interested in minimizing v8 memory usage, and I recently saw this
>>> blog post on Lazy Deserialization: https://v8pro
>>> ject.blogspot.ca/2018/02/lazy-deserialization.html
>>>
>>> I've built and run samples/hello-world.cc against static libraries built
>>> from v6.3 and v6.5, and measured the memory usage using Valgrind's Massif
>>> tool.
>>> I expect to see a reduction in memory usage with v6.5 (due to the lazy
>>> deserialization), but I don't. Is there something I need to do in the code
>>> to enable the lazy deserialization?
>>>
>>
>> Are you sure you're using a snapshot build? If so, lazy deserialization
>> should be enabled by default. What architecture / OS?
>>
>> Locally (Linux x64), I see these numbers:
>>
>> $ out/release/v8_hello_world --no-lazy-deserialization
>> --no-lazy-handler-deserialization --trace-gc
>> Hello, World!
>> name, size, size of objects
>> new_space, 23408, 23408
>> old_space, 820176, 437832
>> code_space, 1039904, 1039904
>> map_space, 525904, 40400
>> large_object_space, 0, 0
>>
>> $ out/release/v8_hello_world --trace-gc
>> Hello, World!
>> name, size, size of objects
>> new_space, 23408, 23408
>> old_space, 820176, 437832
>> code_space, 898208, 396448
>> map_space, 525904, 40400
>> large_object_space, 0, 0
>>
>> Note the difference in code_space. The 'size' column shows the total size
>> of the space, 'size of objects' shows the portion that is actually
>> used/allocated.
>> From a quick look, Massif also didn't show a difference for me.
>>
>> By the way, since you're looking into memory reductions,
>> isolate-independent builtins (doc <http://goo.gl/Z2HUiM>) might also be
>> of interest.
>>
>> Here's the patch to reproduce my numbers above:
>>
>> diff --git a/samples/hello-world.cc b/samples/hello-world.cc
>> index ab6f0dd8bf..d9257d79e9 100644
>> --- a/samples/hello-world.cc
>> +++ b/samples/hello-world.cc
>> @@ -16,6 +16,7 @@ int main(int argc, char* argv[]) {
>>    std::unique_ptr<v8::Platform> platform = v8::platform::NewDefaultPlatfo
>> rm();
>>    v8::V8::InitializePlatform(platform.get());
>>    v8::V8::Initialize();
>> +  v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
>>
>>    // Create a new Isolate and make it the current one.
>>    v8::Isolate::CreateParams create_params;
>> diff --git a/src/isolate.cc b/src/isolate.cc
>> index 30f67e3233..b85bf18179 100644
>> --- a/src/isolate.cc
>> +++ b/src/isolate.cc
>> @@ -2629,6 +2629,13 @@ void Isolate::Deinit() {
>>
>>    DumpAndResetStats();
>>
>> +  printf("name, size, size of objects\n");
>> +  for (int i = FIRST_SPACE; i <= LAST_SPACE; i++) {
>> +    Space* s = heap_.space(i);
>> +    printf("%s, %zu, %zu\n", heap_.GetSpaceName(i), s->Size(),
>> +           s->SizeOfObjects());
>> +  }
>> +
>>    if (FLAG_print_deopt_stress) {
>>      PrintF(stdout, "=== Stress deopt counter: %u\n",
>> stress_deopt_count_);
>>    }
>>
> --
> --
> v8-users mailing list
> v8-users@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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

Jakob Gruber

Software Engineer

jgru...@google.com

Google Germany GmbH

Erika-Mann-Straße 33

80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg

Diese E-Mail ist vertraulich. Falls sie 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.

-- 
-- 
v8-users mailing list
v8-users@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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to