Ad
  • Custom User Avatar

    After -O2 got introduced to C++ runner, some kata started timing out on compilation. It turned out that large amounts of strings initialized with literals take forever to compile. Large LUTs or precomputed answers or large string inputs used by tests made compilation times skyrocket.

    I can't remember the exact conclusion but I think that using std::string_view or c-strings helped in such cases.

  • Custom User Avatar

    A lot of assembly code is produced thanks to the inclusion of std::string literals and std::map usage.

    Using Clang 8 and O2 optimization level (same environment as CW) my solution produces 515 lines of assembly, hundreds of which are just setting up the program state. Switching from strings to enums reduces it to 136 lines of assembly, half of which, again, simply create a (State, Event) -> State mapping.