I Added a global counter in the most inner loop in intersect_legal_ranges. Counter value at end is, as expected, equal to the number of iterations * n + some small overhead for the ranges that were created as "split" by random. E.g. for 10 iterations and 70,000 genes I got 702,810 (i.e. 70,281 per iteration when n=70,000).
Also note that the slowdown occurs even when the second problematic subroutine (is_contained) is not called at all (the next before it on). The first problematic subroutine (gene_to_legal_range) does not use loops at all and is very simple (I hope you agree)
In reply to Re^6: Some code optimization
by roibrodo
in thread Some code optimization
by roibrodo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |