For some reason the Document class triggers a time consuming garbage collect with gcc 5.4.0 (only one I've tried).
This was seen by compiling precompiled versions of VideoTrack.cpp with and without the Document class using the -ftime-report flag to gcc.
When Document is included the compilation takes 2.2 seconds instead of 2.0 seconds otherwise. -ftime-report says that 160ms of those 200ms is "garbage collect".
If gcc is called with --param ggc-min-expand=200 or with --param ggc-min-heapsize=256000 the gc is avoided and the compilation is 160 milliseconds faster.
Setting a heapsize seems harmless but might of course result in a slightly higher memory usage.
Since clang is the default compiler I'm not going to do anything else but I wanted to document it before I forgot about it.
Comment 1 by dtapu...@chromium.org
, Apr 27 2018