8282# Assemble series in the desired order.
8383def get_series (d ): return [d .get (op , 0 ) for op in ordered_ops ]
8484
85- du_volatile_arr = get_series (Doublets_United_Volatile )
86- du_nonvolatile_arr = get_series (Doublets_United_NonVolatile )
87- ds_volatile_arr = get_series (Doublets_Split_Volatile )
88- ds_nonvolatile_arr = get_series (Doublets_Split_NonVolatile )
89- psql_non_arr = get_series (PSQL_NonTransaction )
90- psql_trans_arr = get_series (PSQL_Transaction )
85+ du_volatile_arr = get_series (Doublets_United_Volatile )
86+ du_nonvolatile_arr = get_series (Doublets_United_NonVolatile )
87+ ds_volatile_arr = get_series (Doublets_Split_Volatile )
88+ ds_nonvolatile_arr = get_series (Doublets_Split_NonVolatile )
89+ psql_non_arr = get_series (PSQL_NonTransaction )
90+ psql_trans_arr = get_series (PSQL_Transaction )
9191
9292# ─────────────────────────────────────────────────────────────────────────────
9393# Markdown Table
@@ -101,9 +101,9 @@ def print_results_markdown():
101101 lines = [header ]
102102
103103 for i , op in enumerate (ordered_ops ):
104- psql_val1 = psql_non_arr [i ] if psql_non_arr [i ] else float ('inf' )
104+ psql_val1 = psql_non_arr [i ] if psql_non_arr [i ] else float ('inf' )
105105 psql_val2 = psql_trans_arr [i ] if psql_trans_arr [i ] else float ('inf' )
106- min_psql = min (psql_val1 , psql_val2 )
106+ min_psql = min (psql_val1 , psql_val2 )
107107
108108 def annotate (v ):
109109 if v == 0 : return "N/A"
@@ -137,7 +137,7 @@ def ensure_min_visible(arr, min_val):
137137
138138def bench1 ():
139139 """Horizontal bars – raw values (pixel scale)."""
140- y , w = np .arange (len (ordered_ops )), 0.1
140+ y , w = np .arange (len (ordered_ops )), 0.1
141141 fig , ax = plt .subplots (figsize = (12 , 8 ))
142142
143143 # Calculate maximum value across all data series to determine scale
@@ -152,19 +152,19 @@ def bench1():
152152 logging .info ("bench1: max_val=%d, min_visible=%d" , max_val , min_visible )
153153
154154 # Apply minimum visibility to all data series
155- du_volatile_vis = ensure_min_visible (du_volatile_arr , min_visible )
155+ du_volatile_vis = ensure_min_visible (du_volatile_arr , min_visible )
156156 du_nonvolatile_vis = ensure_min_visible (du_nonvolatile_arr , min_visible )
157- ds_volatile_vis = ensure_min_visible (ds_volatile_arr , min_visible )
157+ ds_volatile_vis = ensure_min_visible (ds_volatile_arr , min_visible )
158158 ds_nonvolatile_vis = ensure_min_visible (ds_nonvolatile_arr , min_visible )
159- psql_non_vis = ensure_min_visible (psql_non_arr , min_visible )
160- psql_trans_vis = ensure_min_visible (psql_trans_arr , min_visible )
159+ psql_non_vis = ensure_min_visible (psql_non_arr , min_visible )
160+ psql_trans_vis = ensure_min_visible (psql_trans_arr , min_visible )
161161
162- ax .barh (y - 2 * w , du_volatile_vis , w , label = 'Doublets United Volatile' , color = 'salmon' )
163- ax .barh (y - w , du_nonvolatile_vis ,w , label = 'Doublets United NonVolatile' ,color = 'red' )
164- ax .barh (y , ds_volatile_vis , w , label = 'Doublets Split Volatile' , color = 'lightgreen' )
165- ax .barh (y + w , ds_nonvolatile_vis , w , label = 'Doublets Split NonVolatile' , color = 'green' )
166- ax .barh (y + 2 * w , psql_non_vis , w , label = 'PSQL NonTransaction' , color = 'lightblue' )
167- ax .barh (y + 3 * w , psql_trans_vis , w , label = 'PSQL Transaction' , color = 'blue' )
162+ ax .barh (y - 2 * w , du_volatile_vis , w , label = 'Doublets United Volatile' , color = 'salmon' )
163+ ax .barh (y - w , du_nonvolatile_vis , w , label = 'Doublets United NonVolatile' , color = 'red' )
164+ ax .barh (y , ds_volatile_vis , w , label = 'Doublets Split Volatile' , color = 'lightgreen' )
165+ ax .barh (y + w , ds_nonvolatile_vis , w , label = 'Doublets Split NonVolatile' , color = 'green' )
166+ ax .barh (y + 2 * w , psql_non_vis , w , label = 'PSQL NonTransaction' , color = 'lightblue' )
167+ ax .barh (y + 3 * w , psql_trans_vis , w , label = 'PSQL Transaction' , color = 'blue' )
168168
169169 ax .set_xlabel ('Time (ns)' )
170170 ax .set_title ('Benchmark Comparison: PostgreSQL vs Doublets (Rust)' )
@@ -174,15 +174,15 @@ def bench1():
174174
175175def bench2 ():
176176 """Horizontal bars – raw values on a log scale."""
177- y , w = np .arange (len (ordered_ops )), 0.1
177+ y , w = np .arange (len (ordered_ops )), 0.1
178178 fig , ax = plt .subplots (figsize = (12 , 8 ))
179179
180- ax .barh (y - 2 * w , du_volatile_arr , w , label = 'Doublets United Volatile' , color = 'salmon' )
181- ax .barh (y - w , du_nonvolatile_arr ,w , label = 'Doublets United NonVolatile' ,color = 'red' )
182- ax .barh (y , ds_volatile_arr , w , label = 'Doublets Split Volatile' , color = 'lightgreen' )
183- ax .barh (y + w , ds_nonvolatile_arr , w , label = 'Doublets Split NonVolatile' , color = 'green' )
184- ax .barh (y + 2 * w , psql_non_arr , w , label = 'PSQL NonTransaction' , color = 'lightblue' )
185- ax .barh (y + 3 * w , psql_trans_arr , w , label = 'PSQL Transaction' , color = 'blue' )
180+ ax .barh (y - 2 * w , du_volatile_arr , w , label = 'Doublets United Volatile' , color = 'salmon' )
181+ ax .barh (y - w , du_nonvolatile_arr , w , label = 'Doublets United NonVolatile' , color = 'red' )
182+ ax .barh (y , ds_volatile_arr , w , label = 'Doublets Split Volatile' , color = 'lightgreen' )
183+ ax .barh (y + w , ds_nonvolatile_arr , w , label = 'Doublets Split NonVolatile' , color = 'green' )
184+ ax .barh (y + 2 * w , psql_non_arr , w , label = 'PSQL NonTransaction' , color = 'lightblue' )
185+ ax .barh (y + 3 * w , psql_trans_arr , w , label = 'PSQL Transaction' , color = 'blue' )
186186
187187 ax .set_xlabel ('Time (ns) – log scale' )
188188 ax .set_title ('Benchmark Comparison: PostgreSQL vs Doublets (Rust)' )
0 commit comments