-
-
Notifications
You must be signed in to change notification settings - Fork 391
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
extreme slow down in in_tz
after upgrading from 2.1.2 to 3.0.0
#818
Comments
I was able to improve this slightly by patching the |
more investigation shows that this call to |
This must indeed be an inadvertent regression—the pendulum FAQ shows pendulum's performance was way faster than
benchmark source: import pyperf
runner = pyperf.Runner()
runner.timeit(
"tz change (pendulum)",
"dt.in_tz('America/New_York')",
setup="from pendulum import datetime; dt = datetime(2020, 3, 20, 12, 30, 45, tz='Europe/Amsterdam')",
)
runner.timeit(
"tz change (stdlib)",
"dt.astimezone(target)",
setup="from datetime import datetime; from zoneinfo import ZoneInfo; "
"dt = datetime(2020, 3, 20, 12, 30, 45, tzinfo=ZoneInfo('Europe/Amsterdam')); "
"target = ZoneInfo('America/New_York')",
)
runner.timeit(
"tz change (arrow)",
"dt.to('America/New_York')",
setup="import arrow; dt = arrow.get(2020, 3, 20, 12, 30, 45, 0, tz='Europe/Amsterdam'); "
) |
Issue
Hello, we have recently upgraded to pendulum 3 from 2.1.2 and have noticed an extreme slow down in one of our processes that has to compute a lot of times (a few hundred thousand) in version 2 it would take about ~2 minutes after switching to the latest pendulum version I end up killing the process after about 15 minutes. Doing some investigation I can see it is happening within the
new -
.
in_tz
call and when changing the code to useastimezone
it drops down to about ~43 seconds. Also creating a new project and doing a simplepyinstrument
test on thein_tz
function with a single timezone shows the following speed changeold -
We have pendulum used a lot through the project and are concerned about this slow down within pendulum and do not want to have to rewrite the project to remove it, due to how highly integrated it is with pendulum. What can we do about fixing the speed issues here?
The text was updated successfully, but these errors were encountered: