Discussion
State whether the following is true or false.
An optimising compiler always produces the fastest possible target program for a given source.
Answer: B
Correct answer: False
Optimal code generation is undecidable in general, and the individual subproblems - register allocation and instruction scheduling among them - are NP-hard. Compilers therefore use heuristics that usually improve the program without any guarantee of optimality.
Optimisations also interact: one may block another, and an apparently local improvement can worsen cache or branch behaviour. "Optimising" describes the attempt rather than the outcome, which is why compilers offer several levels rather than one correct answer.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development