Commit eef780ebf2

Andrew Kelley <andrew@ziglang.org>
2022-11-17 08:57:05
CMake: use -O1 instead of -O2 for building generated .c code
Idea here is that this is a sweet spot of not wasting time waiting for optimizations but also getting decent runime performance.
1 parent 33e3db1
Changed files (1)
CMakeLists.txt
@@ -713,8 +713,8 @@ if(MSVC)
   set(ZIG2_COMPILE_FLAGS "/std:c99")
   set(ZIG2_LINK_FLAGS "/STACK:16777216")
 else()
-  set(ZIG1_COMPILE_FLAGS "-std=c99 -O2 -march=native")
-  set(ZIG2_COMPILE_FLAGS "-std=c99 -O2 -march=native")
+  set(ZIG1_COMPILE_FLAGS "-std=c99 -O1 -march=native")
+  set(ZIG2_COMPILE_FLAGS "-std=c99 -O1 -march=native")
   set(ZIG2_LINK_FLAGS "-Wl,-z,stack-size=0x10000000")
 endif()