Remove file loading for critical values #10
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
Consts
that wraps up all the constants used by thediptest.py
module.Consts
class is implemented in a way that forces the variables to stay constant.np.loadtxt
call and directly adding the aforementioned array in theConsts
class.Why?
Currently, the
_CRIT_VALS
numpy array is being read by calling thenp.loadtxt
method. Nevertheless, this adds a redundant call to the file system; in my laptop the reading op takes ~0.56 ms compared to the ~40ns when we directly add the array inside a Python module and import it.How?
dip_crit.txt
.diptest.py
moduleconsts.py
module that wraps up all the constants defined in thediptest.py
module._CRIT_VALS
explicitly inside the module.Testing?
The implementation has been tested locally in a Darwin platform and all the unittests pass with success.