-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
MAINT: Remove python <2.7,<3.3 string/unicode workarounds #8832
Conversation
954e4e9
to
02d6854
Compare
Since we only need to support python 2, we can remove any case where we just pass a single string literal and use the b prefix instead. What we can't do is transform asbytes("tests %d" % num), because %-formatting fails on bytes in python 3.x < 3.5.
02d6854
to
0960eed
Compare
u prefixes are supported in Python 2.7 and 3.3+
c340754
to
6ad2ce7
Compare
6ad2ce7
to
1dc20cb
Compare
thanks, nice cleanup |
Tell me about it. Perhaps now that we don't use these conversion/hack functions much in testing, they can give a deprecation warning on python 3? |
Also, is removing functions from |
technically public api, we could slap deprecation warnings on them but I don't think its worth the effort. |
Hmmm... This had a big performance hit on Especially since none of the things this touches should have any effect on the behaviour of |
ASV does not try to track if the *benchmark* code itself is changed. If
benchmarks are changed, old results need to be invalidated manually.
The results repository in question is here:
https://github.com/pv/numpy-bench
|
Sure, that explains why the regression is there. But why does it attach the regression to this commit, and not to your commit? It has benchmark data for both, and mine came before yours! On a related note, does this mean this was a bad merge, and the benchmark should have been renamed to avoid creating these false regressions? |
The benchmark setup runs it once per day, using the latest benchmark
suite in the master branch.
.
The benchmark suite and the numpy code should be thought as independent
entities --- that they are stored in the same repository is just a
matter of convenience for pull requests.
.
In particular, the benchmark code used to benchmark each commit is
independent of the commit benchmarked (otherwise, it would not be
possible to fix mistakes in benchmarks afterward). Hence, the benchmark
suite and code commit ids are not comparable in general.
.
In principle changes in benchmarks could be tracked automatically by
looking for source code changes. However, this can result to false
positives, so currently you have to do the invalidation manually.
|
Gotcha, that clarifies things Does this mean that if a pull request introduces a benchmark and a fix, that the benchmark will be tested on the previous commit as well? Or did that only happen in this case because the two commits were merged on the same day? |
Since it's run only once per day, benchmark additions or modifications
apply also to other commits made during the same day --- including also
any such commits *preceding* the change in the benchmarks.
.
If you are making changes to benchmark suite that changes results,
either the benchmark name should be changed or the old results be
invalidate.
.
Alternatively, you can send a PR to asv that implements automatic
invalidation of results :) I don't see how to do this reliably however,
so probably it should be optional.
|
automatic invalidation worked pretty well in the vbench suite. It took the checksum of the benchmark and invalided the results when it changed. |
Probably the 90+% solution indeed is just to take a hash of the
inspect.getsourcelines of the benchmark and setup methods.
|
... and the hash (or the source lines themselves) can be stored in the
result json files, and comparisons be done at publish stage. Sounds simple.
|
Perhaps a simple "version" field in benchmarks would do the job too |
This transforms strings to use the
u
andb
prefixes for unicode and bytes:asbytes('hello')
→b'hello'
asbytes_nested(['a', 'b'])
→[b'a', b'b']
asunicode('hello')
→u'hello'
unicode('hello')
→u'hello'
sixu('hello')
→u'hello'
This is fine because
b
is supported on 2.7 and 3.x, andu
is supported on 2.x and 3.3+. Our minimum versions are now 2.7 and 3.4?What we can't do is transform
asbytes("tests %d" % num)
, because %-formattingfails on bytes in python 3.x < 3.5.
As a result,
asunicode
andsixu
are now not used anywhere.