From 45a8cee2598bb479f22dbb8fc439e6b46b68a4b4 Mon Sep 17 00:00:00 2001 From: GatsbyJS Bot Date: Tue, 2 Jun 2020 13:12:36 +0000 Subject: [PATCH] perf(gatsby): drop severe scaling regression caused by analytics (#24709) * perf(gatsby): drop severe scaling regression caused by analytics Regression introduced in https://github.com/gatsbyjs/gatsby/pull/22851 The problem seems to be that these calls to `v8.serialize` trigger the gc to start a full hold-the-world mark-and-sweep step sooner. In a benchmark of 150k files, the step would trigger almost always after between 100k and 110k queries had run, and it would pause the process for 60+ seconds. Example benchmark results from before and after that PR: ``` info bootstrap finished - 86.758 s success Building production JavaScript and CSS bundles - 9.404s success run queries - 205.676s - 150002/150002 729.31/s success Building static HTML for pages - 142.800s - 150002/150002 1050.44/s info Done building in 451.33 sec ``` ``` info bootstrap finished - 85.933 s success Building production JavaScript and CSS bundles - 8.335s success run queries - 84.795s - 150002/150002 1769.00/s success Building static HTML for pages - 141.000s - 150002/150002 1063.84/s info Done building in 320.158 sec ``` This is very consistent behavior. We looked at the change and agreed that the best was to just drop this measurement since it was for the sake of analytics and a non-vital metric to record. We'd rather have the perf than the metric. Numbers for the fix, same benchmark, first on current master and then on this PR: ``` info bootstrap finished - 79.788s success Building production JavaScript and CSS bundles - 9.635s success run queries - 201.542s - 150002/150002 744.27/s success Building static HTML for pages - 141.535s - 150002/150002 1059.82/s info Done building in 440.766 sec ``` ``` info bootstrap finished - 80.751s success Building production JavaScript and CSS bundles - 9.570s success run queries - 87.162s - 150002/150002 1720.95/s success Building static HTML for pages - 142.609s - 150002/150002 1051.84/s info Done building in 319.151 sec ``` nice! * And drop the import --- yarn.lock | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/yarn.lock b/yarn.lock index 305d8ca..753e7f7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2251,12 +2251,7 @@ dependencies: "@types/node" "*" -"@types/node@*": - version "14.0.6" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.6.tgz#f9e178b2da31a4b0ec60b64649e244c31ce18daf" - integrity sha512-FbNmu4F67d3oZMWBV6Y4MaPER+0EpE9eIYf2yaHhCWovc1dlXCZkqGX4NLHfVVr6umt20TNBdRzrNJIzIKfdbw== - -"@types/node@^8.5.7": +"@types/node@*", "@types/node@^8.5.7": version "8.10.61" resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.61.tgz#d299136ce54bcaf1abaa4a487f9e4bedf6b0d393" integrity sha512-l+zSbvT8TPRaCxL1l9cwHCb0tSqGAGcjPJFItGGYat5oCTiq1uQQKYg5m7AF1mgnEBzFXGLJ2LRmNjtreRX76Q==