From: Evan You Date: Thu, 23 Nov 2023 15:18:23 +0000 (+0800) Subject: perf(compiler-sfc): remove magic-string trim on script X-Git-Tag: v3.4.0-alpha.2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e8e3ec6ca7392e43975c75b56eaaa711d5ea9410;p=thirdparty%2Fvuejs%2Fcore.git perf(compiler-sfc): remove magic-string trim on script magic-string's trim method uses a regex check for aborting which turns out to be extremely expensive - it cna take up to 10% time in total SFC compilation! The usage here is purely aesthetic so simply removing it for a big perf gain is well worth it. --- diff --git a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap index f4f44284b5..4cc3cf611d 100644 --- a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap +++ b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap @@ -14,7 +14,8 @@ return { a } `; exports[`SFC analyze