Make import statements more efficient
Opened this issue · 1 comments
tms-bananaquit commented
If a dot-import (np.sqrt
) is called, the lookup resolves np
first, then sqrt
. This doesn't make a big difference except within a for loop, apparently -- and most of the detectors are going to be run within for loops. In that case, it's better to do e.g. from numpy import sqrt
instead of import numpy as np
.
We might get slightly better performance, then, if we go through update
methods and identify eventual calls to dot-imports and replace them with the pattern above.
tms-bananaquit commented
This doesn't seem to make a consistently big difference, just timing a couple runs of KDQTreePartitioner.build
. Leaving it for now.