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

Improve compile time #1768

Merged
merged 8 commits into from
Jun 4, 2019
Merged

Conversation

pmconrad
Copy link
Contributor

@pmconrad pmconrad commented May 21, 2019

Fixes #1738 (hopefully)

The idea is to explicitly specialize certain templates (mostly exceptions, APIs and serialization) in .cpp files and declare them extern in .hpp files. This avoids them being instantiated (and thus compiled) separately whereever they are used.

The result is almost 40% faster build with a significant reduction of required RAM and diskspace. The effect on replay time seems to be lower than the error from measuring.

Measurements:

Version Compile time (full build with -j 2) Resulting total object file size Replay time (32M blocks)
6a57bd9 (develop) 4905.86user 142.54system 45:36.04elapsed 184%CPU (0avgtext+0avgdata 5910336maxresident)k 5883632inputs+36297912outputs (621major+79699588minor)pagefaults 1930514440 4494s
275e5bf (this branch) 2995.77user 109.49system 27:34.96elapsed 187%CPU (0avgtext+0avgdata 3329756maxresident)k 400912inputs+30901272outputs (323major+60177298minor)pagefaults 1129394680 4399s

Note: Requires changes in fc as well - bitshares/bitshares-fc#133

@oxarbitrage
Copy link
Member

nice! is the 40% build time reduction only in windows or all ?

@abitmore abitmore added this to the 3.2.0 - Feature Release milestone May 21, 2019
@pmconrad
Copy link
Contributor Author

Measured on my linux desktop. Don't have a windows machine to test with.

@abitmore
Copy link
Member

@cwyyprog try this?

@pmconrad pmconrad force-pushed the 1738_compile_time branch from d1de4e2 to edbb245 Compare May 28, 2019 19:49
@pmconrad pmconrad marked this pull request as ready for review May 28, 2019 19:53
@pmconrad
Copy link
Contributor Author

The fc bump includes the fix for #1688

@oxarbitrage
Copy link
Member

I made a test and i was not able to get a 40% faster build in Ubuntu 18.04 but just a 15% .

develop branch:

real	77m46,590s
user	74m55,983s
sys	2m37,780s

pull request:

real	66m3,149s
user	63m3,007s
sys	2m32,247s

Also, did you made snapshots of the 2 at block 32M. I think it might worth it.

@pmconrad
Copy link
Contributor Author

pmconrad commented Jun 2, 2019

Snapshot comparison at 37.9M blocks produced empty diff.

@pmconrad pmconrad force-pushed the 1738_compile_time branch 2 times, most recently from 6dfff17 to c657635 Compare June 4, 2019 11:39
@pmconrad pmconrad force-pushed the 1738_compile_time branch from c657635 to 285d64d Compare June 4, 2019 11:40
@pmconrad pmconrad merged commit 2594a92 into bitshares:develop Jun 4, 2019
@pmconrad pmconrad deleted the 1738_compile_time branch June 4, 2019 13:30
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