Skip to content

Sim-compile performance #479

@timsherwood

Description

@timsherwood

I was playing around with different optimizations of sim-compile... we know that compile time is a big problem as the design scales, and so I was looking into auto-extraction of procedures but a VERY funny thing is happening. In the past I guess I just assumed that -O0 would be the fasted compile time (I mean it make sense right? no optimizations?) but here is what I foud.

At -O0, function extraction helps compile time (482s → 178-190s) but bloats .so and hurts sim time due to unoptimized function call overhead (boo!) so then I tried it with -O1.

Just switching to -O1 takes vanilla baseline compile time from 482s to 4.3s — a 112x speedup in compile time! The .so drops from 807K to 145K and sim is also 12x faster. GCC's own optimizer at -O1 does everything our extraction does and more.

At -O1, function extraction seems to actively hurt — compile goes from 4.3s to 20-23s (the extra function definitions give GCC more to analyze), while .so and sim are essentially unchanged.

I have not tested this rigorously, but for 100x compile time speed up for a 1 byte change to the source code seems like a tradeoff worth investigating :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions