From 1dec296000da4913de8edec4c1c845452f6fdfef Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Fri, 10 Nov 2017 04:40:43 -0800 Subject: [PATCH] Downgrade uglify-js from 3.1.8 to 3.1.1 Summary: Uglify@3.1.7 is causing some perf issues (more specifically, this commit: https://github.com/mishoo/UglifyJS2/commit/5b4b07e9a7d67e593c6ae8d54dc77d174afd25ac) that are impacting TTI on RN views and increased memory usage. More specifically, code like: ``` function nonTrivialFn(pre) { return pre + Math.random(); } function hotFunctionCalledALotOfTimes(num) { return nonTrivialFn(num + Math.random()); } hotFunctionCalledALotOfTimes(3); hotFunctionCalledALotOfTimes(5); ``` in v3.1.7 gets converted to: ``` function hotFunctionCalledALotOfTimes(num){ return function(pre) { return pre + Math.random(); }(num + Math.random()) } hotFunctionCalledALotOfTimes(3); hotFunctionCalledALotOfTimes(5); ``` This causes a function creation each time `hotFunctionCalledALotOfTimes` is called. By comparison, in v3.1.6, that previous code was converted to: ``` function nonTrivialFn(pre){ return pre + Math.random() } function hotFunctionCalledALotOfTimes(num){ return nonTrivialFn(num + Math.random()) } hotFunctionCalledALotOfTimes(3); hotFunctionCalledALotOfTimes(5); ``` Reviewed By: jeanlauliac, alexeylang Differential Revision: D6296740 fbshipit-source-id: b3988d886e607103ec3ae6b9763b2f0411a8aa3c --- packages/metro-bundler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/metro-bundler/package.json b/packages/metro-bundler/package.json index 5d1938a8..b843e200 100644 --- a/packages/metro-bundler/package.json +++ b/packages/metro-bundler/package.json @@ -45,7 +45,7 @@ "source-map": "^0.5.6", "temp": "0.8.3", "throat": "^4.1.0", - "uglify-es": "^3.1.8", + "uglify-es": "^3.1.0", "wordwrap": "^1.0.0", "write-file-atomic": "^1.2.0", "xpipe": "^1.0.5"