-
Notifications
You must be signed in to change notification settings - Fork 22
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
A few performance improvements #380
Conversation
Hum, I think accumulating the db first should actually be slower. |
But for that, great work! About eta, I really don't recall why it is there. CC @CohenCyril |
It's a internal way to achieve the same feature as |
Well it seems to be consistently a tad faster here (like 2-3% total compil time on MathComp) but no idea why.
I haven't tried that, I'll do. |
So, I did try accumulating the db after main and it seems consistently 2 to 3% slower on MC2 compilation than accumulating the db first. No idea why. @gares why do you expect it to be faster? |
I think my original reasoning was wrong, but we can still improve over your solution in two ways. The compilation cache is simplistic in the sense that the unit composing a command/tactics are considered in linear dependency order. So when one changes all the following ones are recompiled. Still units which are DBs are shared among programs, and apparently in HB that unit is large (or better it is made of many tiny units). If you put the DB first, then it has no dependency on other files, so every time you change it and you run a command:
So next time you run the same command (assuming it does not change the DB) the cache hits. If you put the DB last it is considered to depend on the previous files, so if you have 2 commands accumulating the DB over a different list of base files, well, these two "copies" of the DB have different dependencies and are recompiled independently (like in git, their hash also includes the hash of their ancestors, which are different). So one way to improve is to introduce (in elpi) the notion of unit dependency but that is not immediate. |
1e7c435
to
16b415b
Compare
So you were right, absolutely no measurable performance impact (the accumulation time is indeed vastly dominated by the DB). I pushed the code with an explanatory comment nonetheless. |
Thanks for trying. But if in the end the time is the same, maybe it's better without the unneeded files accumulated in structure.v no? Or I misunderstood your measurement? |
16b415b
to
dc9c6e4
Compare
You're right, done. |
The compress predicate had a cubic number of entries in the size of a hierarchy whereas sub-class is only quadratic. Compilation of MathComp: before: 22:57 (1.53 GB) HB.structure: 05:42 HB.instance: 02:31 after: 20:36 (1.26 GB) HB.structure: 03:10 HB.instance: 02:29
Compilation of MathComp: before: 20:36 (1.26 GB) HB.structure: 03:10 HB.instance: 02:29 after: 17:46 (1.24 GB) HB.structure: 01:37 HB.instance: 02:18
Compilation of MathComp: before: 17.46 (1.24 GB) HB.structure: 01:37 HB.instance: 02:18 after: 17.22 (1.27 GB) HB.structure: 01:38 HB.instance: 02:21
dc9c6e4
to
9116e20
Compare
Thanks! |
Compilation of MathComp:
Compilation of Analysis:
or 06:32 (1.25 GB) with same HB (time x 3.20 (memory x 1.43))