Sure, here are cumulative times for my top 20 functions:
16296815 function calls (16296814 primitive calls) in 134.211
CPU seconds
Ordered by: cumulative time
List reduced from 147 to 20 due to restriction <20>
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.001 0.001 134.211 134.211 <string>:1(<module>)
1 0.014 0.014 134.210 134.210 __init__.py:485(run)
9 3.859 0.429 134.101 14.900 __init__.py:378(my_foofunc)
492752 38.530 0.000 91.471 0.000 __init__.py:124(my_barfunc)
18805 12.051 0.001 30.618 0.002 __init__.py:197(my_bazfunc)
290592 2.154 0.000 27.650 0.000 polygon.py:176(__init__)
290454 3.835 0.000 23.079 0.000
polygon.py:408(geos_polygon_from_py)
290454 16.494 0.000 18.875 0.000
polygon.py:279(geos_linearring_from_py)
5407065 14.571 0.000 14.571 0.000 {numpy.core._dotblas.dot}
334548 6.447 0.000 10.423 0.000 linalg.py:1213(norm)
290429 1.373 0.000 9.328 0.000 prepared.py:38(intersects)
290444 4.939 0.000 7.956 0.000 predicates.py:9(__call__)
22291 5.551 0.000 5.774 0.000 topology.py:42(__call__)
603481 3.387 0.000 4.614 0.000 base.py:100(empty)
13963 0.093 0.000 4.218 0.000 base.py:324(intersection)
312889/312888 0.998 0.000 4.069 0.000 base.py:107(__del__)
553438 1.984 0.000 3.576 0.000 __init__.py:67(my_quxfunc)
5644 0.040 0.000 3.187 0.001 {reduce}
8328 0.107 0.000 3.112 0.000 __init__.py:432(my_quuxfunc)
332680 3.042 0.000 3.042 0.000 {method 'any' of
'numpy.ndarray' objects}
and the relevant callees:
Function called...
ncalls
tottime cumtime
polygon.py:176(__init__) -> 290454
0.874 2.416 base.py:126(_set_geom)
290454
3.835 23.079 polygon.py:408(geos_polygon_from_py)
polygon.py:408(geos_polygon_from_py) -> 290454
0.368 0.368 __init__.py:247(POINTER)
290454
16.494 18.875 polygon.py:279(geos_linearring_from_py)
polygon.py:279(geos_linearring_from_py) -> 290430
0.401 0.401 __init__.py:247(POINTER)
290430
1.678 1.678 __init__.py:485(cast)
1
0.000 0.000 linestring.py:56(array_interface)
290478
0.302 0.302 {len}
(Hopefully you can view that with a fixed-width font, it looks awful
in my gmail.)
It seems that it spends a lot of time within the interpreter in
geos_linearring_from_py.
And here are the top ten with my hack in Shapely 1.2.3:
12521229 function calls (12521228 primitive calls) in 110.695
CPU seconds
Ordered by: cumulative time
List reduced from 147 to 10 due to restriction <10>
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.001 0.001 110.695 110.695 <string>:1(<module>)
1 0.014 0.014 110.694 110.694 __init__.py:499(run)
9 3.221 0.358 110.583 12.287 __init__.py:392(my_foofunc)
492752 45.957 0.000 72.299 0.000 __init__.py:128(my_barfunc)
18805 12.068 0.001 30.631 0.002 __init__.py:211(my_bazfunc)
5407065 14.572 0.000 14.572 0.000 {numpy.core._dotblas.dot}
290429 1.450 0.000 10.424 0.000 prepared.py:38(intersects)
334548 6.442 0.000 10.420 0.000 linalg.py:1213(norm)
290444 5.841 0.000 8.976 0.000 predicates.py:9(__call__)
22291 5.563 0.000 5.783 0.000 topology.py:42(__call__)
Most of the Polygons are constructed from within what I'm calling
'my_barfunc' here. It gets a nice performance boost. Not that it is
that huge a difference, my application just happens to be time
sensitive. I would maybe just stick with the older version of Shapely
for the time being, except that this hack stops working when I turn on
pprocess (I guess because of the fork), and I have been using that in
order to multitask-enable this code.
Thanks!
Kyle
On Wed, Jan 26, 2011 at 9:07 PM, Sean Gillies <[email protected]> wrote:
> Hi Kyle,
>
> I'd love to make Shapely faster, but I'm regretting that I made
> coordinate sequences mutable. Also, the underlying GEOS pointer is an
> implementation detail that might disappear in some future version.
>
> Can you post your profile stats?
>
_______________________________________________
Community mailing list
[email protected]
http://lists.gispython.org/mailman/listinfo/community