Perl Programming quiz, level Advanced, question 36
| Question: | If you've got a Perl application that's running very slowly, and it uses a lot of regular expressions, which of these is most likely to speed things up without too much effort? |
| Answer 1: | Try to decrease the number of optional parts in your regular expressions, and increase the number of characters that must match exactly. This was the CORRECT answer |
| Answer 2: | Combine a series of simple regular expressions into one larger one so that the regular expression engine doesn't have to be primed too many times. |
| Answer 3: | Use the variable $& to capture the matching string, rather than using $1, &~036;2 etc. |
| Answer 4: | Use the -O2 command line option to make the compiler optimise your program to be run-time efficient |
| Answer 5: | Eliminate as many anchors and assertations as possible from the regular expression |
This was a question from our quiz ... but we have now provided you with
the answer (above) - we prefer to provide you with information rather than to
puzzle you.
|
|