I wonder if Perl performs common subexpression elimination?
And what kind of optimisations are done?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, but I do.
Now, I don’t unroll loops by hand, because loops are an easier concept once you’re familiar with programming. Because you could be doing anything with a sequence of commands, the loop makes it clear that you’re repeating a task.
But CSE is something that makes more efficient code regardless of the implementation of the language. So I do it. It doesn’t make the code baroque, and it works in languages where it’s not automatically included.
Perl offers compression of syntax so there are often less subexpressions that have to be hand-eliminated.