File tree 2 files changed +15
-2
lines changed
2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ const BUILD_OPTIONS: ESBuild.BuildOptions = {
11
11
} ;
12
12
13
13
if ( import . meta. main ) {
14
+ const start = performance . now ( ) ;
14
15
await Dictionary . build ( ) ;
15
16
await ESBuild . build ( BUILD_OPTIONS ) ;
17
+ const end = performance . now ( ) ;
18
+ // deno-lint-ignore no-console
19
+ console . log ( `Total time took: ${ Math . floor ( end - start ) } ms` ) ;
16
20
}
Original file line number Diff line number Diff line change @@ -8,9 +8,13 @@ const DESTINATION = new URL("./dictionary.ts", import.meta.url);
8
8
export async function build ( ) : Promise < void > {
9
9
// deno-lint-ignore no-console
10
10
console . log ( "Building dictionary..." ) ;
11
+ const start = performance . now ( ) ;
11
12
const text = await Deno . readTextFile ( SOURCE ) ;
13
+ const startDictionary = performance . now ( ) ;
14
+ const dictionary = parseDictionary ( text ) ;
15
+ const endDictionary = performance . now ( ) ;
12
16
const json = JSON . stringify (
13
- Object . fromEntries ( parseDictionary ( text ) ) ,
17
+ Object . fromEntries ( dictionary ) ,
14
18
undefined ,
15
19
2 ,
16
20
) ;
@@ -22,8 +26,13 @@ import { Dictionary } from "./type.ts";
22
26
export const dictionary: Dictionary = new Map(Object.entries(${ json } ));
23
27
` ;
24
28
await Deno . writeTextFile ( DESTINATION , code ) ;
29
+ const end = performance . now ( ) ;
30
+ const total = Math . floor ( end - start ) ;
31
+ const parsing = Math . floor ( endDictionary - startDictionary ) ;
25
32
// deno-lint-ignore no-console
26
- console . log ( "Building dictionary done" ) ;
33
+ console . log (
34
+ `Building dictionary done in ${ total } ms (parsing dictionary took ${ parsing } ms)` ,
35
+ ) ;
27
36
}
28
37
if ( import . meta. main ) {
29
38
await build ( ) ;
You can’t perform that action at this time.
0 commit comments