Python: Speedup our eight slowest pytests (one at a time please)
Feature description
At the end of our GitHub Actions build
jobs, there is a list of the slowest ones.
Are there ways to speed up these tests without reducing our functionality or our code coverage?
Please only fix one algorithm per pull request.
- 16.64s call neural_network/simple_neural_network.py::neural_network.simple_neural_network.forward_propagation
- 6.15s call backtracking/word_search.py::backtracking.word_search.word_exists
- 4.61s call digital_image_processing/test_digital_image_processing.py::test_local_binary_pattern
- 2.59s call backtracking/power_sum.py::backtracking.power_sum.backtrack
- 2.19s call machine_learning/xgboost_regressor.py::machine_learning.xgboost_regressor.main
- 1.73s call maths/prime_numbers.py::maths.prime_numbers.slow_primes
- 1.43s call backtracking/power_sum.py::backtracking.power_sum.solve
- 1.00s call other/dijkstra_bankers_algorithm.py::other.dijkstra_bankers_algorithm.BankersAlgorithm.main ================= 1506 passed, 25 warnings in 71.23s (0:01:11) =================
Also, those 25 pytest warnings are worth fixing!!!
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Comments: 19 (19 by maintainers)
Commits related to this issue
- simple_neural_network.py: Fewer forward propogations to speed tests Closes #9718 — committed to TheAlgorithms/Python by cclauss 8 months ago
@cclauss tried backtracking/word_search.py to measure the execution time of each option:
code: called each option 10 times
The longest time, as expected, is ‘AAAAAAAAAAAAABB’, it is a gigantic number of times longer.
Output:
I pointed out in #8785 that
neural_network/simple_neural_network.py
has multiple issues (I don’t think it even implements a neural network) and could do with a rewrite. Ideally whatever new implementation replaces it should run a lot more quickly.