MCPcopy Index your code
hub / github.com/grantjenks/python-sortedcontainers / display

Function display

tests/benchmark_scale.py:276–290  ·  view source on GitHub ↗

Display performance summary with ratio of ops/sec.

(name, times, size, last=['', 0])

Source from the content-addressed store, hash-verified

274
275
276def display(name, times, size, last=['', 0]):
277 "Display performance summary with ratio of ops/sec."
278
279 times.sort()
280 median_time = times[len(times) / 2]
281 operations = size / 100
282 ops_sec = operations / median_time
283
284 last_name, last_ops_sec = last
285 ratio = last_ops_sec / ops_sec if name == last_name else float('nan')
286 last[0], last[1] = name, ops_sec
287
288 template = '@%9s %.0e %.0e %14.5f %12.3f %6.3f'
289 print(template % (name, size, operations, median_time, ops_sec, ratio))
290 sys.stdout.flush()
291
292
293if __name__ == '__main__':

Callers 2

benchmark_addFunction · 0.85
benchmark_delFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected