File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ """Benchmark: read_table — parse a 100k-row tab-separated file"""
2+ import json , time
3+ import pandas as pd
4+
5+ ROWS = 100_000
6+ WARMUP = 2
7+ ITERATIONS = 5
8+
9+ # Build TSV file
10+ tmp_path = "/tmp/gh-aw/agent/bench_read_table.tsv"
11+ with open (tmp_path , "w" ) as f :
12+ f .write ("id\t value\t label\n " )
13+ for i in range (ROWS ):
14+ f .write (f"{ i } \t { i * 1.1 :.4f} \t cat_{ i % 50 } \n " )
15+
16+ for _ in range (WARMUP ):
17+ pd .read_table (tmp_path )
18+
19+ start = time .perf_counter ()
20+ for _ in range (ITERATIONS ):
21+ pd .read_table (tmp_path )
22+ total = (time .perf_counter () - start ) * 1000
23+
24+ print (json .dumps ({
25+ "function" : "read_table" ,
26+ "mean_ms" : total / ITERATIONS ,
27+ "iterations" : ITERATIONS ,
28+ "total_ms" : total ,
29+ }))
Original file line number Diff line number Diff line change 1+ /**
2+ * Benchmark: readTable — parse a 100k-row tab-separated string
3+ */
4+ import { readTable } from "../../src/index.js" ;
5+
6+ const ROWS = 100_000 ;
7+ const WARMUP = 2 ;
8+ const ITERATIONS = 5 ;
9+
10+ // Build TSV string (tab-separated)
11+ const lines = [ "id\tvalue\tlabel" ] ;
12+ for ( let i = 0 ; i < ROWS ; i ++ ) {
13+ lines . push ( `${ i } \t${ ( i * 1.1 ) . toFixed ( 4 ) } \tcat_${ i % 50 } ` ) ;
14+ }
15+ const tsvContent = lines . join ( "\n" ) ;
16+
17+ for ( let i = 0 ; i < WARMUP ; i ++ ) {
18+ readTable ( tsvContent ) ;
19+ }
20+
21+ const start = performance . now ( ) ;
22+ for ( let i = 0 ; i < ITERATIONS ; i ++ ) {
23+ readTable ( tsvContent ) ;
24+ }
25+ const total = performance . now ( ) - start ;
26+
27+ console . log (
28+ JSON . stringify ( {
29+ function : "read_table" ,
30+ mean_ms : total / ITERATIONS ,
31+ iterations : ITERATIONS ,
32+ total_ms : total ,
33+ } ) ,
34+ ) ;
You can’t perform that action at this time.
0 commit comments