News for hackers. Stuff that matters.
Re:Ask HN: What is it about compiling that is so time-consum... by brundolf on Monday January 30, 2023 @02:43PM (#34585325)
> because they spend a lot of time optimizing code that isn't particularly important

This is a pretty loaded and weird thing to say. You're right that optimization accounts for a major chunk of the time, but compilers are often slow while optimizing code that is important

Re:Ask HN: What is it about compiling that is so time-consum... by ender341341 on Monday January 30, 2023 @03:56PM (#34586254)
I think they're saying that for the vast majority of code it doesn't matter to optimize as the actual time to run the code is trivial compared to waiting on network calls and the like.
Re:Ask HN: What is it about compiling that is so time-consum... by brundolf on Monday January 30, 2023 @04:45PM (#34586887)
I've never seen any evidence (or even anecdotes, until now) saying this is true. It could be, who knows, but it's a weird thing to assert out of the blue in this kind of conversation, especially when just "doing optimizations [important or not] is a major contributor" is widely-accepted as true and is enough to answer the OP's question
Re:Ask HN: What is it about compiling that is so time-consum... by layer8 on Monday January 30, 2023 @06:03PM (#34587914)
Hotspot JIT compilers rely on that. They only compile and optimize code where significant CPU time is spent (hotspots). The majority of code usually remains unJITed.
Re:Ask HN: What is it about compiling that is so time-consum... by brundolf on Monday January 30, 2023 @06:12PM (#34588023)
I guess the crux is that "important" is relative. JIT compilers (especially hot-spot optimizing ones) are most commonly used for high-level languages like JavaScript, which have a different definition of "important to performance" than eg. systems languages. The OP is talking about compilers that produce binaries, so I think the relevant definition of "important" is that of systems languages, not of the typical JITed language
Re:Ask HN: What is it about compiling that is so time-consum... by layer8 on Monday January 30, 2023 @06:55PM (#34588548)
I was thinking of Java and C#, which are widely deployed for desktop and backend applications, as well as on mobile (Android specifically), and which are quite competitive with C for application performance.
Re:Ask HN: What is it about compiling that is so time-consum... by mike_hearn on Tuesday January 31, 2023 @07:23AM (#34594196)
e.g. code that is only ever executed once is a large proportion of many programs (init codepaths etc), but it doesn't make much difference to spend time optimizing it.
Re:Ask HN: What is it about compiling that is so time-consum... by Am4TIfIsER0ppos on Monday January 30, 2023 @09:47PM (#34590213)
What if I don't make any network calls and I also don't want to wait for `div` to complete when `shr` would do?