File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
Expand file tree Collapse file tree 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 = {
1111} ;
1212
1313if ( import . meta. main ) {
14+ const start = performance . now ( ) ;
1415 await Dictionary . build ( ) ;
1516 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` ) ;
1620}
Original file line number Diff line number Diff line change @@ -8,9 +8,13 @@ const DESTINATION = new URL("./dictionary.ts", import.meta.url);
88export async function build ( ) : Promise < void > {
99 // deno-lint-ignore no-console
1010 console . log ( "Building dictionary..." ) ;
11+ const start = performance . now ( ) ;
1112 const text = await Deno . readTextFile ( SOURCE ) ;
13+ const startDictionary = performance . now ( ) ;
14+ const dictionary = parseDictionary ( text ) ;
15+ const endDictionary = performance . now ( ) ;
1216 const json = JSON . stringify (
13- Object . fromEntries ( parseDictionary ( text ) ) ,
17+ Object . fromEntries ( dictionary ) ,
1418 undefined ,
1519 2 ,
1620 ) ;
@@ -22,8 +26,13 @@ import { Dictionary } from "./type.ts";
2226export const dictionary: Dictionary = new Map(Object.entries(${ json } ));
2327` ;
2428 await Deno . writeTextFile ( DESTINATION , code ) ;
29+ const end = performance . now ( ) ;
30+ const total = Math . floor ( end - start ) ;
31+ const parsing = Math . floor ( endDictionary - startDictionary ) ;
2532 // 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+ ) ;
2736}
2837if ( import . meta. main ) {
2938 await build ( ) ;
You can’t perform that action at this time.
0 commit comments