Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish the benchmarking code #44

Closed
lucic71 opened this issue Aug 2, 2023 · 1 comment
Closed

Publish the benchmarking code #44

lucic71 opened this issue Aug 2, 2023 · 1 comment

Comments

@lucic71
Copy link

lucic71 commented Aug 2, 2023

Hi,

I'm interested in running the benchmarks you presented here: https://www.mattiamontanari.com/opengjk/docs/benchmarks/

But I didn't find the code for doing that.

Do you consider publishing the benchmarking code in this repo?

@MattiaMontanari
Copy link
Owner

@lucic71 sorry for the delay! I used a very random and simplistic approach for that. I intended to have better benchmarking suite, but then I ran out of time. Here's the code:

import openGJK_cython as opengjk
import numpy as np
import google_benchmark as benchmark
from google_benchmark import Counter

@benchmark.register(name="Two")
@benchmark.option.unit(benchmark.kMicrosecond)
@benchmark.option.min_time(3)
@benchmark.option.repetitions(5)
@benchmark.option.report_aggregates_only(True) 
# @benchmark.option.use_real_time() // wallclock

def sedddsst(state):
    a = np.array([[1.0, 1.0, 1.0], [1.0, 1.0, 1.0]])
    b = np.array([[-1., -1., -1.], [-1., -1., -1.]])
    num_foo = 0
    while state:
        output = opengjk.pygjk(a, b)
        num_foo += output

@benchmark.register(name="Hundres")
@benchmark.option.unit(benchmark.kMicrosecond)
@benchmark.option.min_time(3)
@benchmark.option.repetitions(5)
@benchmark.option.report_aggregates_only(True) 

def randDist_100(state):
    a = np.arange(1, 10.0, 0.5).reshape(-1,3).astype('double')
    b = -a
    num_foo = 0
    while state:
        output = opengjk.pygjk(a, b)
        num_foo += output

@benchmark.register(name="Thousand")
@benchmark.option.unit(benchmark.kMicrosecond)
@benchmark.option.min_time(3)
@benchmark.option.repetitions(5)
@benchmark.option.report_aggregates_only(True) 

def randDist_1000(state):
    a = np.arange(1, 10.0, 0.01).reshape(-1,3).astype('double')
    b = -a
    num_foo = 0
    while state:
        output = opengjk.pygjk(a, b)
        num_foo += output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants