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

Benchmark functions should (if possible) be tested in order #18

Open
kdodia opened this issue Jan 6, 2015 · 1 comment
Open

Benchmark functions should (if possible) be tested in order #18

kdodia opened this issue Jan 6, 2015 · 1 comment

Comments

@kdodia
Copy link

kdodia commented Jan 6, 2015

It would be nice for scanfuncs to preserve order when scanning functions, although I will admit I don't know if this is possible.

According to the *.py scan

funcs = pyclbr.readmodule_ex(name, [path])
funcnames = []
for key, val in funcs.items():
    if (any(key.startswith(prefix) for prefix in prefixes) and
            val.file == filename):
        funcnames.append(key)
return funcnames

—the functions are stored in a dictionary returned by pyclbr, which clobbers order. Thus, despite providing empty, small, and large benchmark functions in that order, the result generally will not be. Ex:

eriknw_benchtoolz

@eriknw
Copy link
Member

eriknw commented Jan 6, 2015

Makes sense to respect the order specified by the user.

The function objects returned by pyclbr.readmodule_ex have a lineno attribute, so this should be straightforward to do. See documentation here: https://docs.python.org/2/library/pyclbr.html#function-objects

I believe the table printer sorts alpha-numerically as well, so that will need to be updated too (perhaps add an option).

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