Performance: Speed up of deepcopy for Miller#461
Performance: Speed up of deepcopy for Miller#461CSSFrancis wants to merge 1 commit intopyxem:developfrom
Conversation
|
Thank you for looking into making deepcopying faster. Your solution only deepcopies the vectors and not the phase, which is not in line with the current behavior. The phase should not be shared. If deepcopying the phase is a bottleneck we should look into improving the speed of this method instead. |
|
I realize now that copying only the data is what you want in the case you describe... Are you happy with a parameter |
|
@hakonanes let me look into this more. I think deepcopying only the data is a good solution but I'll look into the phase deepcopy as well. |
|
A sidenote: I've considered replacing |
|
@CSSFrancis @hakonanes thanks for looking into this! I think the Are there other examples in other codebases where If the speed ups are useful in diffsims then I think this PR should be an internal optimisation rather than in orix, such that the copying scope is well-defined and controlled, ie. it is known that |
|
Thank you for your input, @harripj. I agree with you on all points. The deepcopy method is meant to be used by end users or in the setup of more demanding methods, not repeatedly inside a loop or similar. But if we can get any speed up that would be nice. |
Description of the change
Speeds up deep copy for
Millerclass. Current deep copy is slowed down by using thedeepcopyfunction.This causes issues in
diffsimswhen we have to repeatedly copy and rotate someReciprocalLatticeVectorFor reviewers
__init__.py.section in
CHANGELOG.rst.__credits__inorix/__init__.pyand in.zenodo.json.