1212__license__ = "SPDX-License-Identifier: MIT"
1313
1414import csv
15- import hashlib
1615import itertools
1716import math
1817import pickle
@@ -51,19 +50,19 @@ class BenchmarkRecord:
5150 """
5251
5352 algorithm : str
54- configuration_hash : str
53+ configuration_hash : int
5554 data : str
5655 threshold : float
5756 trace_path : str | None = None
5857
5958 @property
60- def key (self ) -> tuple [str , str , str , float ]:
59+ def key (self ) -> tuple [str , int , str , float ]:
6160 """
6261 Get the unique composite key for this benchmark run.
6362
6463 Returns
6564 -------
66- tuple[str, str , str, float]
65+ tuple[str, int , str, float]
6766 A tuple containing (algorithm, configuration_hash, data, threshold)
6867 used for identifying the record in the registry.
6968 """
@@ -122,7 +121,7 @@ def execute(self) -> list[tuple[BenchmarkRecord, OnlineDetectionTrace[Any]]]:
122121 the benchmark metadata record and the corresponding detection trace.
123122 """
124123 results : list [tuple [BenchmarkRecord , OnlineDetectionTrace [Any ]]] = []
125- registry : dict [tuple [str , str , str , float ], BenchmarkRecord ] = {}
124+ registry : dict [tuple [str , int , str , float ], BenchmarkRecord ] = {}
126125 registry_path : Path | None = None
127126
128127 if self .__dump_dir is not None :
@@ -135,7 +134,7 @@ def execute(self) -> list[tuple[BenchmarkRecord, OnlineDetectionTrace[Any]]]:
135134 for row in reader :
136135 record = BenchmarkRecord (
137136 algorithm = row ["algorithm" ],
138- configuration_hash = row ["configuration_hash" ],
137+ configuration_hash = int ( row ["configuration_hash" ]) ,
139138 data = row ["data" ],
140139 threshold = float (row ["threshold" ]),
141140 trace_path = row ["trace_path" ] if row ["trace_path" ] else None ,
@@ -144,7 +143,7 @@ def execute(self) -> list[tuple[BenchmarkRecord, OnlineDetectionTrace[Any]]]:
144143
145144 for (algorithm , thresholds ), provider in itertools .product (self .__algorithms , self .__providers ):
146145 algo_name = str (algorithm )
147- config_hash = str ( hashlib . md5 ( algo_name . encode ( "utf-8" )). hexdigest ()[: 8 ] )
146+ config_hash = hash ( algorithm . configuration )
148147 data_name = provider .name
149148
150149 for threshold in thresholds :
@@ -161,7 +160,7 @@ def execute(self) -> list[tuple[BenchmarkRecord, OnlineDetectionTrace[Any]]]:
161160 continue
162161
163162 steps = list (self .__solver .run (algorithm , provider , threshold ))
164- trace = OnlineDetectionTrace .from_run (steps )
163+ trace = OnlineDetectionTrace .from_run (steps , algo_name , config_hash )
165164
166165 record = BenchmarkRecord (algo_name , config_hash , data_name , threshold , None )
167166
0 commit comments