enhancement/patch 6x improvement on localize
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pytz |
New
|
Medium
|
Unassigned |
Bug Description
[Not a bug]
I do a *a lot* of timezone conversions in one particular app, so I was looking for ways to speed up localize.
The following attachment gives an alternate version of localize that is somewhere between 5-7x faster. It passes all tests except for 9 (out of 152430) from the zdump.out. All the hand crafted and doc tests pass.
# FAIL: test_local_
# FAIL: test_local_
# FAIL: test_local_
# FAIL: test_local_
# FAIL: test_local_
# FAIL: test_local_
# FAIL: test_local_
# FAIL: test_local_
# FAIL: test_local_
I can't figure why these are failing. Using old and new versions of localize I get the same results, so the test
must be doing something slightly more interesting, that I'm not exactly sure of.
The new algorithm IMHO is bit more straight forward than the existing, but I welcome your feedback, especially concerning why those 9 test cases are so special!
If you are interesting in including it in a release, I can swap the license/copyright as need be. It also works just fine as standalone function, so if you don't want replace your existing implementation, it could live in a new file such as "tzutil.py" or something.
thoughts welcome.
--nickg
Changed in pytz: | |
importance: | Undecided → Medium |