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

pyproj.transform() 2.2.0 running 11,000 times slower than pyproj.transform() 1.9.5.1 #484

Closed
wrwetzel opened this issue Nov 13, 2019 · 3 comments
Labels

Comments

@wrwetzel
Copy link

wrwetzel commented Nov 13, 2019

Code Sample, a copy-pastable example if possible

import pyproj
from itertools import repeat
import sys
import time

wgs84     = pyproj.Proj("+init=EPSG:4326")
NewJersey = pyproj.Proj("+init=EPSG:3424")

point = [ 621214, 547761 ]   
count = 1000000.    # 100. for 2.2.2 or 2.4.0
start = time.time()
for i in repeat(None, int(count) ):
    tpoint = pyproj.transform( NewJersey, wgs84,  point[0] * .3048, point[1] * .3048)

runtime = time.time() - start

print( "pyproj version:", pyproj.__version__ )
print( "python version:", sys.version )
print( "count:", count )
print( "time:", runtime )
print( "per iteration:", runtime/count )

Problem description

With release 1.9.5.1 the above programs takes 5.457669973373413e-06 sec/iteration
With release 2.2.2 it takes 0.060466268062591554 sec/iteration, ~11,000 times slower.

Why such a huge decrease in performance?
Thanks,
Bill

Results shown are for python2.7 I got similar results with pyproj 2.4.0 on python3.7.

Expected Output

('pyproj version:', '2.2.2')
('python version:', '2.7.17 (default, Oct 22 2019, 09:14:09) \n[GCC 9.2.0]')
('count:', 100.0)
('time:', 6.046626806259155)
('per iteration:', 0.060466268062591554)
---------------------------------------------------------------
('pyproj version:', '1.9.5.1')
('python version:', '2.7.17 (default, Oct 22 2019, 09:14:09) \n[GCC 9.2.0]')
('count:', 1000000.0)
('time:', 5.457669973373413)
('per iteration:', 5.457669973373413e-06)

Environment Information

Shown above and...
Linux-5.3.8-arch1-1-x86_64-with-arch

Installation method

pip2 for python2.7
pacman -S for python3.7

@wrwetzel wrwetzel added the bug label Nov 13, 2019
@snowman2
Copy link
Member

The good news is that we have already encountered this and there is a solution:
https://pyproj4.github.io/pyproj/stable/advanced_examples.html#optimize-transformations

@wrwetzel
Copy link
Author

Great, thanks very much. The suggest approach works fine... but why?

What ever changed to make the original approach so slow?

@snowman2
Copy link
Member

What ever changed to make the original approach so slow?

These links might help gain some insight:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants