Skip to content

Commit bf83a35

Browse files
authored
Update 2025-11-30-comptime-c-functions.md
1 parent 9daaf42 commit bf83a35

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

_posts/2025-11-30-comptime-c-functions.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,12 @@ int main() {
192192
193193
# Generic hash map
194194
195-
Because a hash map is a much more complex data structure than a stack, GCC struggles to optimize it perfectly, even with macros.
196-
197-
Clang on the other hand manages to completely optimize the below macro-based hash map away, which isn't surprising, given that Clang generally produces more optimized Assembly than GCC.
198-
199-
GCC doesn't on the other hand, even when passed these extra flags:
195+
Because a hash map is a much more complex data structure than a stack, GCC struggles to optimize it perfectly, even with macros and extra flags:
200196
- `-finline-limit=999999`
201197
- `--param max-inline-insns-single=999999`
202198
- `--param max-inline-insns-auto=999999`
203199
204-
It still keeps the `calloc()` and `free()` around:
200+
GCC still keeps the `calloc()` and `free()` calls around:
205201
```nasm
206202
"main":
207203
sub rsp, 8
@@ -220,6 +216,8 @@ It still keeps the `calloc()` and `free()` around:
220216

221217
But GCC manages to optimize them away when the `printf("All tests passed.\n");` at the end of `main()` is removed, for some unknown reason.
222218

219+
Clang on the other hand manages to completely optimize the below macro-based hash map away, which isn't surprising, given that Clang generally produces more optimized Assembly than GCC.
220+
223221
Copy of the code on [Compiler Explorer](https://godbolt.org/z/eecK3rK7z):
224222

225223
```c

0 commit comments

Comments
 (0)