-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compiler, ci: remove acyclic and run leak tests (#1104)
## Summary Local tests have shown that the compiler does create cycles and leak memory during compilation. As such we are dropping all acyclic annotations and prepare the stage to either live without them or have them reintroduced over time. ## Details Aside from dropping acyclic annotations, this commit prepares the compiler for future work on memory optimizations with these changes: - Cycle collection is disabled for the compiler itself. This is because the compilation command is not a long-running task and we value speed over memory usage here. - nimsuggest is set to collect cycles only after running a command. This should keep memory usage low during extended usage while allowing the compilation phases to stay at top speed. - A CI pipeline has been setup to test the compiler using LeakSanitizer, making sure that leaks are caught before they are introduced. Some performance numbers due to these changes: Benchmarked via: `hyperfine -- "bin/nim c --forceBuild --compileOnly --verbosity:0 --hints:off --warnings:off compiler/nim.nim"` Time Ratio Before 9.155s ± 0.044s 1.00 After 9.599s ± 0.039s 1.05
- Loading branch information
Showing
13 changed files
with
94 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Test compiler and tools for memory leaks | ||
|
||
on: | ||
# This is for passing required checks | ||
pull_request: | ||
merge_group: | ||
|
||
jobs: | ||
leaktest: | ||
# Skip this for PRs | ||
if: github.event_name != 'pull_request' | ||
|
||
name: Compiler and tools leak test | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
filter: tree:0 | ||
|
||
- name: Enable annotations | ||
run: echo "::add-matcher::.github/nim-problem-matcher.json" | ||
|
||
- name: Build release binaries with LeakSanitizer | ||
run: | | ||
./koch.py all-strict \ | ||
-d:useMalloc \ | ||
--passC:-fsanitize=leak \ | ||
--passC:"-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer" \ | ||
--passL:-fsanitize=leak \ | ||
--debuginfo \ | ||
--linedir | ||
- name: Run tools tests | ||
run: ./koch.py testTools | ||
|
||
# NOTE: We don't run the full test suite here as self-bootstrap | ||
# and tools testsuite can be considered enough to rat out memory leaks | ||
# within the compiler itself. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters