Skip to content

fix: optimize compilation time of gsl library#6039

Merged
PastaPastaPasta merged 2 commits into
dashpay:developfrom
knst:optimize-gsl-compilation
Aug 29, 2024
Merged

fix: optimize compilation time of gsl library#6039
PastaPastaPasta merged 2 commits into
dashpay:developfrom
knst:optimize-gsl-compilation

Conversation

@knst

@knst knst commented May 30, 2024

Copy link
Copy Markdown
Collaborator

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

UdjinM6 commented May 31, 2024

Copy link
Copy Markdown

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

@knst

knst commented Jun 3, 2024

Copy link
Copy Markdown
Collaborator Author

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

knst commented Aug 26, 2024

Copy link
Copy Markdown
Collaborator Author

@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

UdjinM6 commented Aug 26, 2024

Copy link
Copy Markdown

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

@UdjinM6 UdjinM6 left a comment

Copy link
Copy Markdown

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
@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