File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright 2025 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import { expandGlob } from "jsr:@std/fs" ;
6
+ import { format } from "jsr:@std/fmt/bytes" ;
7
+
8
+ import { decode , encode } from "../mod.ts" ;
9
+
10
+ const BENCHMARKS = await ( async ( ) => {
11
+ const result = [ ] ;
12
+ for await (
13
+ const file of expandGlob ( "*.js.map" , { root : import . meta. dirname } )
14
+ ) {
15
+ const mapContent = Deno . readTextFileSync ( file . path ) ;
16
+ const mapJson = JSON . parse ( mapContent ) ;
17
+ const info = decode ( mapJson ) ;
18
+ result . push ( {
19
+ name : file . name ,
20
+ info,
21
+ size : mapContent . length ,
22
+ } ) ;
23
+ }
24
+ return result ;
25
+ } ) ( ) ;
26
+
27
+ for ( const { name, info, size } of BENCHMARKS ) {
28
+ Deno . bench ( `${ name } , ${ format ( size ) } ` , ( ) => {
29
+ encode ( info ) ;
30
+ } ) ;
31
+ }
You can’t perform that action at this time.
0 commit comments