File tree Expand file tree Collapse file tree 10 files changed +53
-40
lines changed Expand file tree Collapse file tree 10 files changed +53
-40
lines changed Original file line number Diff line number Diff line change 1- import { createCommonJS } from 'mlly'
21import { baseCompile } from '@intlify/message-compiler'
2+ import { createCommonJS } from 'mlly'
33import { displayMemoryUsage } from './utils.mjs'
44
55const { require } = createCommonJS ( import . meta. url )
Original file line number Diff line number Diff line change 11global . __INTLIFY_JIT_COMPILATION__ = true // set JIT mode for Node.js
22
3- import { createCommonJS } from 'mlly'
4- import { baseCompile } from '@intlify/message-compiler'
53import {
6- translate ,
7- createCoreContext ,
4+ clearCompileCache ,
85 compile ,
6+ createCoreContext ,
97 registerMessageCompiler ,
10- clearCompileCache
8+ translate
119} from '@intlify/core-base'
10+ import { baseCompile } from '@intlify/message-compiler'
11+ import { createCommonJS } from 'mlly'
12+ import { dirname , resolve } from 'node:path'
1213import { createI18n } from 'vue-i18n'
13- import { resolve , dirname } from 'path'
14- import { readJson , displayMemoryUsage } from './utils.mjs'
14+ import { displayMemoryUsage , readJson } from './utils.mjs'
1515
1616const { require } = createCommonJS ( import . meta. url )
1717const { Suite } = require ( 'benchmark' )
@@ -34,6 +34,8 @@ async function main() {
3434 console . log ( `complex pattern on ${ len } resources (JIT + AOT):` )
3535 console . log ( )
3636
37+ resources [ 'no apples' ] = 'no apples'
38+
3739 registerMessageCompiler ( compile )
3840 const precompiledResources = precompile ( resources )
3941
Original file line number Diff line number Diff line change 11global . __INTLIFY_JIT_COMPILATION__ = true // set JIT mode for Node.js
22
3- import { createCommonJS } from 'mlly'
43import {
5- translate ,
6- createCoreContext ,
4+ clearCompileCache ,
75 compile ,
6+ createCoreContext ,
87 registerMessageCompiler ,
9- clearCompileCache
8+ translate
109} from '@intlify/core-base'
10+ import { createCommonJS } from 'mlly'
11+ import { dirname , resolve } from 'node:path'
1112import { createI18n } from 'vue-i18n'
12- import { resolve , dirname } from 'path'
13- import { readJson , displayMemoryUsage } from './utils.mjs'
13+ import { displayMemoryUsage , readJson } from './utils.mjs'
1414
1515const { require } = createCommonJS ( import . meta. url )
1616const { Suite } = require ( 'benchmark' )
@@ -24,6 +24,8 @@ async function main() {
2424 console . log ( `complex pattern on ${ len } resources (JIT):` )
2525 console . log ( )
2626
27+ resources [ 'no apples' ] = 'no apples'
28+
2729 registerMessageCompiler ( compile )
2830
2931 const ctx = createCoreContext ( {
Original file line number Diff line number Diff line change 1- import { createCommonJS } from 'mlly'
21import {
3- translate ,
2+ clearCompileCache ,
43 createCoreContext ,
5- clearCompileCache
4+ translate
65} from '@intlify/core-base'
6+ import { createCommonJS } from 'mlly'
7+ import { dirname , resolve } from 'node:path'
78import { createI18n } from 'vue-i18n'
8- import { resolve , dirname } from 'path'
9- import { readJson , displayMemoryUsage } from './utils.mjs'
9+ import { displayMemoryUsage , readJson } from './utils.mjs'
1010
1111const { require } = createCommonJS ( import . meta. url )
1212const { Suite } = require ( 'benchmark' )
@@ -20,6 +20,8 @@ async function main() {
2020 console . log ( `complex pattern on ${ len } resources (AOT):` )
2121 console . log ( )
2222
23+ resources [ 'no apples' ] = 'no apples'
24+
2325 const ctx = createCoreContext ( {
2426 locale : 'en' ,
2527 modifiers : {
Original file line number Diff line number Diff line change 1- import { spawn } from 'child_process'
1+ import { spawn } from 'node: child_process'
22
33function run ( pattner ) {
44 return new Promise ( ( resolve , reject ) => {
Original file line number Diff line number Diff line change 11global . __INTLIFY_JIT_COMPILATION__ = true // set JIT mode for Node.js
22
3- import { createCommonJS } from 'mlly'
4- import { baseCompile } from '@intlify/message-compiler'
53import {
6- translate ,
7- createCoreContext ,
4+ clearCompileCache ,
85 compile ,
6+ createCoreContext ,
97 registerMessageCompiler ,
10- clearCompileCache
8+ translate
119} from '@intlify/core-base'
10+ import { baseCompile } from '@intlify/message-compiler'
11+ import { createCommonJS } from 'mlly'
12+ import { dirname , resolve } from 'node:path'
1213import { createI18n } from 'vue-i18n'
13- import { resolve , dirname } from 'path'
14- import { readJson , displayMemoryUsage } from './utils.mjs'
14+ import { displayMemoryUsage , readJson } from './utils.mjs'
1515
1616const { require } = createCommonJS ( import . meta. url )
1717const { Suite } = require ( 'benchmark' )
Original file line number Diff line number Diff line change 11global . __INTLIFY_JIT_COMPILATION__ = true // set JIT mode for Node.js
22
3- import { createCommonJS } from 'mlly'
43import {
5- translate ,
6- createCoreContext ,
4+ clearCompileCache ,
75 compile ,
6+ createCoreContext ,
87 registerMessageCompiler ,
9- clearCompileCache
8+ translate
109} from '@intlify/core-base'
10+ import { createCommonJS } from 'mlly'
11+ import { dirname , resolve } from 'node:path'
1112import { createI18n } from 'vue-i18n'
12- import { resolve , dirname } from 'path'
13- import { readJson , displayMemoryUsage } from './utils.mjs'
13+ import { displayMemoryUsage , readJson } from './utils.mjs'
1414
1515const { require } = createCommonJS ( import . meta. url )
1616const { Suite } = require ( 'benchmark' )
Original file line number Diff line number Diff line change 1- import { createCommonJS } from 'mlly'
21import {
3- translate ,
2+ clearCompileCache ,
43 createCoreContext ,
5- clearCompileCache
4+ translate
65} from '@intlify/core-base'
6+ import { createCommonJS } from 'mlly'
7+ import { dirname , resolve } from 'node:path'
78import { createI18n } from 'vue-i18n'
8- import { resolve , dirname } from 'path'
9- import { readJson , displayMemoryUsage } from './utils.mjs'
9+ import { displayMemoryUsage , readJson } from './utils.mjs'
1010
1111const { require } = createCommonJS ( import . meta. url )
1212const { Suite } = require ( 'benchmark' )
Original file line number Diff line number Diff line change 1- import fs from 'fs/promises'
1+ import fs from 'node: fs/promises'
22
33export async function readJson ( path ) {
44 const data = await fs . readFile ( path , 'utf8' )
Original file line number Diff line number Diff line change 1414 "url" : " https://github.com/inlitify/vue-i18n/issues"
1515 },
1616 "scripts" : {
17- "benchmark" : " node ./benchmark/index.mjs" ,
17+ "bench" : " node ./benchmark/index.mjs" ,
18+ "bench:compile" : " node ./benchmark/compile.mjs" ,
19+ "bench:simple" : " node ./benchmark/simple.mjs" ,
20+ "bench:simple-jit" : " node ./benchmark/simple-jit.mjs" ,
21+ "bench:simple-jit-aot" : " node ./benchmark/simple-jit-aot.mjs" ,
22+ "bench:complex" : " node ./benchmark/complex.mjs" ,
23+ "bench:complex-jit" : " node ./benchmark/complex-jit.mjs" ,
24+ "bench:complex-jit-aot" : " node ./benchmark/complex-jit-aot.mjs" ,
1825 "build" : " tsx ./scripts/build.ts" ,
1926 "build:explorer" : " pnpm --filter @intlify/message-format-explorer build" ,
2027 "build:size" : " pnpm build && run-p build:size-*" ,
You can’t perform that action at this time.
0 commit comments