Skip to content

Infer benchmark data to use from keyword arguments #7

@eriknw

Description

@eriknw

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions