@@ -679,38 +679,73 @@ window.initAndRender = (function () {
679679 const initializer = {
680680 async loadData ( ) {
681681 const [ dataResponse , commitsResponse ] = await Promise . all ( [
682- this . fetchGzippedData (
682+ this . fetchAndParseGzippedJsonl (
683683 "https://vortex-benchmark-results-database.s3.amazonaws.com/data.json.gz"
684684 ) ,
685685 fetch (
686686 "https://vortex-benchmark-results-database.s3.amazonaws.com/commits.json"
687687 ) . then ( ( r ) => r . text ( ) ) ,
688688 ] ) ;
689689
690- // Return raw text data for worker processing
690+ // Return parsed data for worker processing
691+ // dataResponse is now an array of parsed objects instead of a string
691692 return {
692693 benchmarkData : dataResponse ,
693694 commitsData : commitsResponse
694695 } ;
695696 } ,
696697
697- async fetchGzippedData ( url ) {
698+ async fetchAndParseGzippedJsonl ( url ) {
698699 const response = await fetch ( url ) ;
699700 const decompressedStream = response . body . pipeThrough (
700701 new DecompressionStream ( "gzip" )
701702 ) ;
702703 const reader = decompressedStream . getReader ( ) ;
703704 const decoder = new TextDecoder ( ) ;
704- let result = "" ;
705+
706+ let buffer = '' ;
707+ const lines = [ ] ;
705708
706709 while ( true ) {
707710 const { done, value } = await reader . read ( ) ;
708- if ( done ) break ;
709- result += decoder . decode ( value , { stream : true } ) ;
711+
712+ if ( value ) {
713+ buffer += decoder . decode ( value , { stream : true } ) ;
714+
715+ // Process complete lines
716+ const parts = buffer . split ( '\n' ) ;
717+ // Keep the last part (incomplete line) in the buffer
718+ buffer = parts . pop ( ) ;
719+
720+ // Parse and collect complete lines
721+ for ( const line of parts ) {
722+ const trimmed = line . trim ( ) ;
723+ if ( trimmed . length > 0 ) {
724+ try {
725+ lines . push ( JSON . parse ( trimmed ) ) ;
726+ } catch ( e ) {
727+ console . warn ( 'Failed to parse JSONL line:' , trimmed , e ) ;
728+ }
729+ }
730+ }
731+ }
732+
733+ if ( done ) {
734+ // Process any remaining buffer
735+ buffer += decoder . decode ( ) ;
736+ const trimmed = buffer . trim ( ) ;
737+ if ( trimmed . length > 0 ) {
738+ try {
739+ lines . push ( JSON . parse ( trimmed ) ) ;
740+ } catch ( e ) {
741+ console . warn ( 'Failed to parse final JSONL line:' , trimmed , e ) ;
742+ }
743+ }
744+ break ;
745+ }
710746 }
711747
712- result += decoder . decode ( ) ;
713- return result ;
748+ return lines ;
714749 } ,
715750
716751 parseJsonl ( jsonl ) {
@@ -754,7 +789,7 @@ window.initAndRender = (function () {
754789 ] ;
755790
756791 elementIds . forEach ( ( id ) => {
757- const camelCaseId = id . replace ( / - ( .) / g, ( match , char ) =>
792+ const camelCaseId = id . replace ( / - ( .) / g, ( _match , char ) =>
758793 char . toUpperCase ( )
759794 ) ;
760795 domElements [ camelCaseId ] = document . getElementById ( id ) ;
0 commit comments