@@ -57,11 +57,11 @@ describe('1 billion row challenge', () => {
5757 await testChallenge ( 10_000_000 )
5858 } )
5959
60- it ( 'should create 100_000_000 measurements' , async ( ) => {
61- await createMeasurements ( 100_000_000 )
60+ it ( 'should create 50_000_000 measurements' , async ( ) => {
61+ await createMeasurements ( 50_000_000 )
6262 } )
63- it ( 'should run 100_000_000 row challenge' , async ( ) => {
64- await testChallenge ( 100_000_000 )
63+ it ( 'should run 50_000_000 row challenge' , async ( ) => {
64+ await testChallenge ( 50_000_000 )
6565 } )
6666} )
6767
@@ -110,12 +110,17 @@ async function createMeasurements(numberOfRows: number = 1000000) {
110110 }
111111
112112 // make up the rest of the data
113- for ( let i = stations . length ; i < numberOfRows ; i ++ ) {
114- if ( i > 0 && i % 50_000_000 === 0 ) {
113+ for ( let i = stations . length ; i < numberOfRows ; i += 10_000 ) {
114+ if ( i > 0 && i % 10_000_000 === 0 ) {
115115 console . log ( `Wrote ${ i } measurements in ${ Date . now ( ) - startedOn } ms` )
116116 }
117- let station = stations [ Math . floor ( Math . random ( ) * stations . length ) ]
118- await write ( `${ station . id } ;${ station . measurement ( ) } \n` )
117+
118+ let chunkCsv = ''
119+ for ( let j = 0 ; j < Math . min ( 10_000 , numberOfRows - i ) ; j ++ ) {
120+ let station = stations [ Math . floor ( Math . random ( ) * stations . length ) ]
121+ chunkCsv += `${ station . id } ;${ station . measurement ( ) } \n`
122+ }
123+ await write ( chunkCsv )
119124 }
120125
121126 console . log ( `Wrote 1brc_${ numberOfRows } _rows.csv in ${ Date . now ( ) - startedOn } ms` )
0 commit comments