Closed KYLChiu closed 7 months ago
Reduces the calls to piece_at. Before:
tests/test_searcher.py::TestPerformance::test_perf_base[r1b2rk1/ppq2ppp/3bpn2/3pP3/8/2PB2B1/PP1N1PPP/R2QK2R b KQ - 0 11-6] 87048525 function calls (86843206 primitive calls) in 28.221 seconds ncalls tottime percall cumtime percall filename:lineno(function) 169782 4.990 0.000 13.048 0.000 evaluator.py:214(evaluate) 14054764 4.113 0.000 7.579 0.000 __init__.py:725(piece_at) 14675498 2.798 0.000 2.798 0.000 __init__.py:735(piece_type_at)
After
tests/test_searcher.py::TestPerformance::test_perf_base[r1b2rk1/ppq2ppp/3bpn2/3pP3/8/2PB2B1/PP1N1PPP/R2QK2R b KQ - 0 11-6] 82706717 function calls (82501398 primitive calls) in 27.367 seconds Ordered by: internal time List reduced from 156 to 10 due to restriction <10> ncalls tottime percall cumtime percall filename:lineno(function) 169782 5.015 0.000 13.320 0.000 evaluator.py:214(evaluate) 11160202 3.322 0.000 6.037 0.000 __init__.py:725(piece_at) 11780936 2.234 0.000 2.234 0.000 __init__.py:735(piece_type_at)
Reduces the calls to piece_at. Before:
After