Well, I bet it would be possible to teach Perl to optimize substr($str,-1) (when not being assigned to and when the "-1" is a literal constant) into chop. But then, why? That is, would the bit of bloat (and the potential for introducing bugs) be worth allowing people to write chop long-hand without the performance penalty?
BTW, they are all close enough to the same speed that I don't think I'd ever worry about the speed difference. (:
- tye (but my friends call me "Tye")In reply to (tye)Re: Benchmarking chop/substr/split
by tye
in thread Benchmarking chop/substr/split
by larryl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |