File: benchmark.py

package info (click to toggle)
siphashc 1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 108 kB
  • sloc: ansic: 209; python: 91; makefile: 2
file content (17 lines) | stat: -rwxr-xr-x 425 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env python
"""Simple timing benchmark.

Used for testing possible regressions when changing code."""
from __future__ import print_function
import timeit

print('Benchmark (short):')
print(timeit.timeit(
    "siphash('0123456789ABCDEF', 'a')",
    "from siphashc import siphash"
))
print('Benchmark (long):')
print(timeit.timeit(
    "siphash('0123456789ABCDEF', 'a' * 1000)",
    "from siphashc import siphash"
))