Skip to content

wavec build/run default to -O0, which is ~4x slower than -O2; the default is not documented #930

Closed

Description

@panda0042

wavec build / wavec run compile at -O0 unless an optimization flag is given, and the difference is large: about 4x on integer- and array-heavy code. Nothing I found tells a new user that the default is unoptimized.

Measurement

A pure-Wave number-conversion routine (a double-to-shortest-decimal formatter and a decimal-to-double parser built on a fixed-size big integer, about 1000 lines), timed on 200,000 values with a C++ implementation of the same algorithm as the baseline (C++ built with -O2):

case C++ -O2 Wave default Wave -O0 Wave -O2 Wave -O3
format, short numbers 22 ms 118 ms 108 ms 36 ms 37 ms
format, random doubles 340 ms 1294 ms 1304 ms 336 ms 346 ms
parse, random doubles 185 ms 656 ms 667 ms 210 ms 191 ms

The default build behaves exactly like an explicit -O0 (compare the two Wave columns), and -O2 brings the Wave code level with C++. -O2 is accepted before or after the subcommand (wavec -O2 run f.wave, wavec run -O2 f.wave).

Same source, same machine, same compiler, only the flag changes.

Suggestion

Either default build / run to an optimizing level (keeping -O0 for debug builds), or print the active level in the build output and mention in the getting-started docs that -O2 should be used for anything performance-sensitive or benchmarked.

Version

wavec 0.2.1-pre-beta (LLVM 21.1.8), Ubuntu 26.04, x86_64.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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