https://github.com/mupq/pqm4
Raw File
Tip revision: 5d0fe862d26b1726c1c986fb612e027195486007 authored by Matthias J. Kannwischer on 20 March 2024, 03:13:23 UTC
Adds Apache-2.0 license in addition to CC0
Tip revision: 5d0fe86
benchmarks.py
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0 or CC0-1.0
from mupq import mupq
from interface import parse_arguments, get_platform
import sys

if __name__ == "__main__":
    args, rest = parse_arguments()
    platform, settings = get_platform(args)
    with platform:
        schemes = [s for s in rest if s not in ['--nostack',
                                                '--nospeed',
                                                '--nohashing',
                                                '--nosize']]
        if "--nostack" not in rest:
            test = mupq.StackBenchmark(settings, platform)
            if test.test_all(schemes):
                sys.exit(1)

        if "--nospeed" not in rest:
            test = mupq.SpeedBenchmark(settings, platform)
            if test.test_all(schemes):
                sys.exit(1)

        if "--nohashing" not in rest:
            test = mupq.HashingBenchmark(settings, platform)
            if test.test_all(schemes):
                sys.exit(1)

        if "--nosize" not in rest:
            test = mupq.SizeBenchmark(settings, platform)
            if test.test_all(schemes):
                sys.exit(1)
back to top