Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimise sigma calculation code in dials.integrate #1399

Merged
merged 3 commits into from
Sep 11, 2020

Conversation

jbeilstenedmands
Copy link
Contributor

Replace

selection = flex.size_t(range(i0, i1))
val = x.select(selection)

with functionally identical
val = x[i0:i1]

Gives significant performance improvement as the second case is within a loop with the target function calculation.
Also remove an unnecessary enumerate.

Just testing on beta-lactamase:
master

6.1: Using 90666 / 91208 reflections for sigma calculation
        Calculating E.S.D Beam Divergence.
7.3: Calculating E.S.D Reflecting Range (mosaicity).
51.1:  sigma b: 0.039018 degrees
         sigma m: 0.056053 degrees

branch

   6.0: Using 90666 / 91208 reflections for sigma calculation
        Calculating E.S.D Beam Divergence.
   7.1: Calculating E.S.D Reflecting Range (mosaicity).
  29.5:  sigma b: 0.039018 degrees
         sigma m: 0.056053 degrees

Verified the output is identical using @graeme-winter's new matching tool.

@jbeilstenedmands jbeilstenedmands changed the title Optimise sigma calculation in dials.integrate Optimise sigma calculation code in dials.integrate Sep 10, 2020
@dagewa
Copy link
Member

dagewa commented Sep 10, 2020

That's a remarkable improvement for a simple change. Good spot!

@codecov
Copy link

codecov bot commented Sep 10, 2020

Codecov Report

Merging #1399 into master will increase coverage by 2.56%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1399      +/-   ##
==========================================
+ Coverage   64.70%   67.26%   +2.56%     
==========================================
  Files         616      616              
  Lines       69735    91437   +21702     
  Branches     9546    15771    +6225     
==========================================
+ Hits        45120    61504   +16384     
- Misses      22835    27771    +4936     
- Partials     1780     2162     +382     

@jbeilstenedmands jbeilstenedmands merged commit a693451 into master Sep 11, 2020
ndevenish pushed a commit that referenced this pull request Sep 14, 2020
Use slicing for more optimised calculation.
@Anthchirp Anthchirp deleted the sigma_calculation_optimisation branch September 14, 2020 11:59
@ndevenish ndevenish mentioned this pull request Sep 14, 2020
ndevenish added a commit that referenced this pull request Sep 14, 2020
- ``dials.integrate``: fix crash when run with integrator=3d_threaded (#1404)
- ``dials.integrate``: Minor performance improvements (#1399)
- ``dials.stills_process``: Add parameter ``max_images=`` to limit the number of processed images
- ``dials.stills_process``: MPI performance improvements for large datasets
- ``dials.stills_process``: Fix error when using split logs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants