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

Infer benchmark data to use from keyword arguments #7

Open
eriknw opened this issue Jun 21, 2014 · 0 comments
Open

Infer benchmark data to use from keyword arguments #7

eriknw opened this issue Jun 21, 2014 · 0 comments

Comments

@eriknw
Copy link
Member

eriknw commented Jun 21, 2014

Similar to #6, but has a different set of challenges. To summarize, I would like to be able to provide values to use for benchmarks via keyword arguments:

def bench(data=[0, 10, 10000]):
    zeros(data)

When displaying output, benchtoolz should be intelligent enough to use the name of the input if it is given, such as:

data_empty = 0
data_small = 10
data_large = 10000

def bench(data=[data_empty, data_small, data_large]):
    zeros(data)

Another way to label input may be to allow a dictionary to be given:

def bench(data={'empty': 0, 'small': 10, 'large': 10000}):
    zeros(data)

I don't know if a dictionary should be supported, because best practice will be to use keyword arguments for simple data, such as someflag=[True, False].

Another variant (pitfall?) to be aware of is if values are pre-initialized in a list, such as:

bench_data = [0, 10, 1000]

def bench(data=bench_data):
    zeros(data)
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

1 participant