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

fix: optimize compilation time of gsl library #6039

Merged
merged 2 commits into from
Aug 29, 2024

Conversation

knst
Copy link
Collaborator

@knst knst commented May 30, 2024

Issue being fixed or feature implemented

This header gsl/pointers.h is included in multiple other headers all over codebase.
Any extra line of code inside gsl/pointers.h makes all project to compile slower.

What was done?

Removed headers <algorithm>, <system_error>, <iosfwd> from gsl/pointers.h

How Has This Been Tested?

Run command 5 times, takes minimum time:

  • baseline
$ time g++ -o /tmp/a.out gsl/pointers.h -O2 -g -I.
real    0m0,572s
user    0m0,461s
sys     0m0,108s
  • removed algorithm:
$ time g++ -o /tmp/a.out gsl/pointers.h -O2 -g -I.
real    0m0,505s
user    0m0,398s
sys     0m0,107s
  • removed algorithm and system_error:
real    0m0,332s
user    0m0,265s
sys     0m0,067s
  • disabled iostream:
$ time g++ -o /tmp/a.out gsl/pointers.h -O2 -g -I. -D GSL_NO_IOSTREAMS
real    0m0,316s
user    0m0,256s
sys     0m0,060s

as a result, overall project compilation time is also improved: make clean ; sleep 3s ; time make -j20

real    5m42,934s
user    80m35,127s
sys     6m40,735s
real    5m28,862s
user    75m31,931s
sys     6m32,591s

Breaking Changes

N/A

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone

@UdjinM6
Copy link

UdjinM6 commented May 31, 2024

Let's wait for the upstream PR to be merged first

@knst
Copy link
Collaborator Author

knst commented Jun 3, 2024

Let's wait for the upstream PR to be merged first

for reference: microsoft/GSL#1153

@knst knst modified the milestones: 21, 21.1 Jul 9, 2024
@UdjinM6 UdjinM6 modified the milestones: 21.1, 21.2 Aug 8, 2024
@knst
Copy link
Collaborator Author

knst commented Aug 26, 2024

@PastaPastaPasta @UdjinM6 let's get this one merged. I compile Dash every day on laptop and extra 10 seconds off compilation time for clean build is a noticeable improvement for me.

I will create follow-up PR once that one is merged (if any difference to merge): microsoft/GSL#1153

@UdjinM6
Copy link

UdjinM6 commented Aug 26, 2024

pls rebase

knst added 2 commits August 26, 2024 16:16
We do not use this feature and implementation is trivial: just call `get()`
it removes:
 - algorithm: `forward` is a part of utility not algorithm
 - system_error: `hash` is already declared in memory
@knst knst force-pushed the optimize-gsl-compilation branch from 1d79221 to dc59cbc Compare August 26, 2024 09:17
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

utACK dc59cbc

@PastaPastaPasta PastaPastaPasta merged commit 8d3f313 into dashpay:develop Aug 29, 2024
33 checks passed
@UdjinM6 UdjinM6 modified the milestones: 21.2, 22 Oct 29, 2024
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.

3 participants