@@ -11,7 +11,7 @@ import {
1111import type { Stats , TextFileResource , VFileSystem } from 'cspell-io' ;
1212import { compareStats , toFileURL , urlBasename } from 'cspell-io' ;
1313
14- import { measurePerfFn } from '../../perf/index.js' ;
14+ import { measurePerf } from '../../perf/index.js' ;
1515import type {
1616 DictionaryDefinitionInlineInternal ,
1717 DictionaryDefinitionInternal ,
@@ -273,10 +273,7 @@ async function load(reader: Reader, uri: URL, options: LoadOptions): Promise<Spe
273273
274274async function legacyWordList ( reader : Reader , filename : URL , options : LoadOptions ) {
275275 const lines = await reader . readLines ( filename ) ;
276- return measurePerfFn ( 'legacyWords' , ( ) => _legacyWordListSync ( lines , filename , options ) ) ;
277- }
278-
279- function _legacyWordListSync ( lines : Iterable < string > , filename : URL , options : LoadOptions ) {
276+ using _ = measurePerf ( 'legacyWords' ) ;
280277 const words = pipe (
281278 lines ,
282279 // Remove comments
@@ -290,10 +287,7 @@ function _legacyWordListSync(lines: Iterable<string>, filename: URL, options: Lo
290287
291288async function wordsPerLineWordList ( reader : Reader , filename : URL , options : LoadOptions ) {
292289 const lines = await reader . readLines ( filename ) ;
293- return measurePerfFn ( 'wordsPerLineWordList' , ( ) => _wordsPerLineWordList ( lines , filename . toString ( ) , options ) ) ;
294- }
295290
296- function _wordsPerLineWordList ( lines : Iterable < string > , filename : string , options : LoadOptions ) {
297291 const words = pipe (
298292 lines ,
299293 // Remove comments
@@ -302,21 +296,19 @@ function _wordsPerLineWordList(lines: Iterable<string>, filename: string, option
302296 opConcatMap ( ( line ) => line . split ( / \s + / gu) ) ,
303297 opFilter ( ( word ) => ! ! word ) ,
304298 ) ;
305- return createSpellingDictionary ( words , options . name , filename , options , true ) ;
299+ return createSpellingDictionary ( words , options . name , filename . href , options , true ) ;
306300}
307301
308302async function loadSimpleWordList ( reader : Reader , filename : URL , options : LoadOptions ) {
309303 const lines = await reader . readLines ( filename ) ;
310- return measurePerfFn ( 'loadSimpleWordList' , ( ) =>
311- createSpellingDictionary ( lines , options . name , filename . href , options ) ,
312- ) ;
304+ using _ = measurePerf ( 'loadSimpleWordList' ) ;
305+ return createSpellingDictionary ( lines , options . name , filename . href , options ) ;
313306}
314307
315308async function loadTrie ( reader : Reader , filename : URL , options : LoadOptions ) {
316309 const content = await reader . read ( filename ) ;
317- return measurePerfFn ( 'loadTrie' , ( ) =>
318- createSpellingDictionaryFromTrieFile ( content , options . name , filename . href , options ) ,
319- ) ;
310+ using _ = measurePerf ( 'loadTrie' ) ;
311+ return createSpellingDictionaryFromTrieFile ( content , options . name , filename . href , options ) ;
320312}
321313
322314function toLines ( content : string ) : string [ ] {
0 commit comments