Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
cypress66
on Sept 18, 2023
|
parent
|
context
|
favorite
| on:
Large Language Models for Compiler Optimization
Printf is horribly slow compared to puts
jmgao
on Sept 18, 2023
[–]
puts isn't applicable here because you actually need to format the %d, but any compiler worth using (i.e. not MSVC:
https://gcc.godbolt.org/z/zx74vY1za
) will optimize a printf of a constant string ending in a newline into a puts.
cypress66
on Sept 18, 2023
|
parent
[–]
No you don't need to format the %d. The same way you collapsed the loop into the constant 5, you collapse that printf into puts("5\n")
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: