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

Use if/elsif instead of ||= with guard clause #3975

Merged
merged 1 commit into from
Feb 13, 2020
Merged

Use if/elsif instead of ||= with guard clause #3975

merged 1 commit into from
Feb 13, 2020

Conversation

cjcolvar
Copy link
Member

The previous version needlessly required that all guard clauses run even when a
prior line had matched and initialized mf_title. Switching to explicit
if/elsif allows for early breaking. This switch helps speed up the view
page of an item with hundreds of sections by avoiding the third case of
file_location which turns out to be expensive (~0.25s).

Making this change resulted in gather_all_comments for this item running under 2s as opposed to 360s before the change.

@cjcolvar cjcolvar force-pushed the elsif branch 2 times, most recently from 7fbccb6 to 226a1bd Compare February 13, 2020 18:33
The previous version needlessly required that all guard clauses run even when a
prior line had matched and initialized mf_title.  Switching to explicit
if/elsif allows for early breaking.  This switch helps speed up the view
page of an item with hundreds of sections by avoiding the third case of
file_location which turns out to be expensive.
@phuongdh
Copy link
Member

#3978

Copy link
Member

@phuongdh phuongdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Story to dry up later #3978

@cjcolvar cjcolvar merged commit c719bf8 into develop Feb 13, 2020
@cjcolvar cjcolvar deleted the elsif branch February 13, 2020 19:34
@joncameron joncameron mentioned this pull request Feb 28, 2020
25 tasks
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.

2 participants