Closed tekknolagi closed 1 year ago
stringBuilderAppendChar
is now 12% of total instructions according to callgrind.
There's also probably some room to split out a version for C-string literals so that it can be inlined and the strlen
can be folded away, which---if you want it---would also make writing characters faster on the current code without my patches.
EDIT: Nevermind, I think this already happens.
Rebased the strncpy
->memcpy
change out of existence since I am less sure about that one and it's not relevant in the PR, I think. I'll figure out how to run tests locally.
The tests look weirdly suspiciously broken, so I figured it was UB or something. Ran locally with -fsanitize=undefined
and can't get them to fail :/
Also, further, I diffed clang.c
before and after my changes and there is no difference...
@tekknolagi Thank you for the optimizations, the numbers look great! I'll try to find time to investigate why the tests fail
:partying_face:
Together, these patches bring down wasm2c compile time of clang.wasm from 1.7s to 1.2s on my machine. Let me know if you would like these and if you would like me to squash.