in reply to (tye)Re: Regular expression to match an A=B type string needs help in storing matched parts of string
in thread Regular expression to match an A=B type string needs help in storing matched parts of string
It gets worse for longer strings.#!/usr/bin/perl use Benchmark 'timethese'; $short = "abcdefg"; $long = $short x 100; timethese(-5, { japhyS => q{ "$short=123" =~ /[^=]+=/ }, tyeS => q{ "$short=123" =~ /[^=]+?=/ }, japhyL => q{ "$long=123" =~ /[^=]+=/ }, tyeL => q{ "$long=123" =~ /[^=]+?=/ }, }); __END__ Benchmark: running japhyL, japhyS, tyeL, tyeS, each for at least 5 CPU seconds... japhyL: 5803.60/s (n=29018) tyeL: 1785.83/s (n=8947) japhyS: 30179.50/s (n=157537) tyeS: 26449.44/s (n=141240)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: (tye)Re: Regular expression to match an A=B type string needs help in storing matched parts of string
by tye (Sage) on Sep 21, 2000 at 22:12 UTC | |
by japhy (Canon) on Sep 21, 2000 at 22:28 UTC |