Performance impact of explicit 'global.gc'

38 views
Skip to first unread message

Vladimir Matveev

unread,
Nov 22, 2015, 12:14:03 AM11/22/15
to v8-users
Hi,

I'm trying to understand the root cause of the interesting effect when I run TypeScript compiler on node 4.2.1 (v8 version: 4.5.103.35): explicity forcing GC after the parsing stage improves running time of subsequent complilation stages and reduces total compilation time on 9-15% (varies based on the codebase). Using 'global.gc' is not a very good option (since user have to explicitly opt-in to use it) so I'd like very much to know if it is possible to identify reasons why calling 'gc' as such a positive effect and if I can do anything in TypeScript codebase to achieve it without using 'gc' (adjust object allocation patterns, reduce amount of short living objects etc.).

Repository with the sample code: https://github.com/vladima/perf-check

I got results of running TypeScript compiler with '--trace_gc --trace_gc_verbose' twice - first time without calling 'gc' and second - with it. They mostly look similar up to the point when log for run with 'gc' contained lines:

[22721:0x2732210] Heap growing factor 4.0 based on mu=0.970, speed_ratio=41 (gc=1267276, mutator=30683)
[22721:0x2732210] Grow: old size: 89394 KB, new limit: 358584 KB (4.0)
[22721:0x2732210]     1378 ms: Mark-sweep 90.1 (129.4) -> 87.4 (130.4) MB, 69.4 / 0 ms [Isolate::RequestGarbageCollection] [GC in old space requested].

---
Thanks,
Vladimir Matveev

Reply all
Reply to author
Forward
0 new messages