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$
3
  • $\begingroup$ The answer could in principle depend on the compiler. $\endgroup$ – Yuval Filmus Jul 2 '19 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 '19 at 11:39
  • $\begingroup$ Thanks prof.Yuval and gnasher $\endgroup$ – user106464 Jul 3 '19 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$
1
  • $\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 '19 at 16:12

Your Answer

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