Java Reference
In-Depth Information
You should avoid trading clarity for efficiency unless you are writing a
performance critical part of the code. Regular expressions are by nature
already cryptic. Sophisticated techniques make them even more diffi-
cult to understand, and so should be used only when needed. And when
you do need to be more efficient be sure that you are doing things
that are more efficientas with all optimizations, you should test carefully
what is actually faster. In the example we give, a sufficiently smart pat-
tern compiler and matcher might make both patterns comparably quick.
Then you would have traded clarity for nothing. And even if today one
is more efficient than the other, a better implementation tomorrow may
make that vanish. With regular expressions, as with any other part of
programming, choosing optimization over clarity is a choice to be made
sparingly.
 
Search WWH ::




Custom Search