1
$\begingroup$

I know that during compilation we need to undergo several stages like lexical analysis, syntax analysis and so on. Which of them takes the most time?

$\endgroup$
  • $\begingroup$ The answer could in principle depend on the compiler. $\endgroup$ – Yuval Filmus Jul 2 at 11:27
  • 1
    $\begingroup$ Also very much depends on the language. Swift type deduction can be pretty hard, and I heard that some popular language has features that are NP-complete at compile time. $\endgroup$ – gnasher729 Jul 2 at 11:39
  • $\begingroup$ Thanks prof.Yuval and gnasher $\endgroup$ – CS_GUY Jul 3 at 4:28
1
$\begingroup$

For a few compilers I've seen compilation times was reduced 3+ fold when optimization was disabled, so otherwise they spent most time on optimization passes.

$\endgroup$
  • $\begingroup$ I remember one compiler where optimisation was limited by available memory, so if you increased RAM, then more optimisations were possible, so more time was spent. $\endgroup$ – gnasher729 Jul 2 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.