Skip to content

Commit 5d38c20

Browse files
authored
feat(compiler): update compiler profiles (#1562)
* Disable debug for benchmark profile The benchmark profile previously had the debug option enabled. This commit comments out this section in the 'Cargo.toml' file, thus disabling the debug option. We want to avoid unnecessary debugging overhead during benchmarking tests: 1. code optimization: loop unrolling, inline, dead code elimination 2. extra instructions and data: less cache hit 3. branch prediction only enable debug when error happened * remove useless cli profile from Cargo.toml 1. The debug mode from the performance profile section has been removed in order to optimize runtime performance. 2. cli profile block has also been entirely removed from Cargo.toml, to simplify the configuration as it was redundant and unecessary. * add comment about Enable overflow checks in release profile The overflow checks have been activated in the release profile of the Cargo.toml file. This change doesn't significantly affect performance since branch prediction handles it quite efficiently. (actually almost no effect) * Update Cargo.toml profiles configuration Removed the non-recommended 'performance' profile from the Cargo.toml and added link-time optimization (LTO) to the 'release' and 'bench' profiles. The thin version of LTO has been used for its balance between performance improvement and compile time cost. Also, inherited the 'release' profile to the 'bench' profile for consistent configurations.
1 parent 647d11d commit 5d38c20

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

Cargo.toml

+7-19
Original file line numberDiff line numberDiff line change
@@ -336,26 +336,14 @@ move-ir-types = { git = "https://github.com/rooch-network/move", rev = "1b49c6e1
336336
# move-bytecode-source-map = { path = "../move/language/move-ir-compiler/move-bytecode-source-map" }
337337
# move-ir-types = { path = "../move/language/move-ir/types" }
338338
[profile.release]
339-
debug = false
340-
overflow-checks = true
341-
342-
# The performance build is not currently recommended
343-
# for production deployments. It has not been widely tested.
344-
[profile.performance]
345-
inherits = "release"
346-
opt-level = 3
347-
debug = true
339+
# enable overflow checks won't affect performance much, branch prediction will handle it well
348340
overflow-checks = true
341+
# enable link-time optimization, which can significantly improve perf but donesn't cost much extra in compile time
342+
# thin LTO is enough for us:
343+
# (https://blog.llvm.org/2016/06/thinlto-scalable-and-incremental-lto.html)
349344
lto = "thin"
350-
codegen-units = 1
351-
352-
[profile.cli]
353-
inherits = "release"
354-
debug = false
355-
opt-level = "z"
356-
lto = "thin"
357-
strip = true
358-
codegen-units = 1
345+
codegen-units = 1 # Help to achieve better result with lto
359346

360347
[profile.bench]
361-
debug = true
348+
inherits = "release"
349+
#debug = true

0 commit comments

Comments
 (0)