After a bugfix and making the "grid size" of the collision hash map smaller the bounce demo runs about 25% faster on the phone now, still too slow though. There are probably some opportunities to cache various values, though at some point it may be inevitable to opt for cythonizing the most-often called code, for example the fixed point library:
271112 function calls (270579 primitive calls) in 18.202 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
85 0.026 0.000 14.123 0.166 widget.py:57(on_timer)
48 0.009 0.000 14.039 0.292 widget.py:74(redraw)
48 0.141 0.003 10.767 0.224 movers/__init__.py:102(run)
1200 1.522 0.001 6.225 0.005 collisions.py:286(run)
1200 0.279 0.000 4.399 0.004 movers/physical.py:92(run)
3677 1.456 0.000 3.781 0.001 collisions.py:114(_get_hash_area)
1200 0.125 0.000 3.772 0.003 entities.py:129(add_pos)
1223 0.062 0.000 3.517 0.003 entities.py:73(_call_pos_listeners)
1223 0.112 0.000 3.454 0.003 collisions.py:65(entity_pos_listener)
1254 0.417 0.000 3.434 0.003 collisions.py:208(_update_hash)
48 0.193 0.004 3.173 0.066 sprites.py:143(draw)
1488 1.445 0.001 2.874 0.002 sprites.py:183(_draw_sprite)
62505 2.626 0.000 2.626 0.000 fixpoint.py:49(mul)
6994 0.789 0.000 1.657 0.000 fixpoint.py:782(is_circle_circle_collision)
1223 0.246 0.000 1.572 0.001 collisions.py:228(_remove_hash_entries)
17684 0.949 0.000 1.558 0.000 fixpoint.py:882(floor)
No comments:
Post a Comment