That is a very substantial improvement and it now beats tobyink's non-regex solution, but cannot touch hdb's:
Partisipants in performance tests: hdb tobyink damianc
b: 4 in s: 6 hdb :: 0.000089 s
b: 4 in s: 6 tobyink :: 0.000336 s
b: 4 in s: 6 damianc :: 0.000081 s
b: 4 in s: 43 hdb :: 0.000070 s
b: 4 in s: 43 tobyink :: 0.000070 s
b: 4 in s: 43 damianc :: 0.000266 s
b: 4 in s: 402 hdb :: 0.000083 s
b: 4 in s: 402 tobyink :: 0.000092 s
b: 4 in s: 402 damianc :: 0.000210 s
b: 4 in s: 4000 hdb :: 0.000391 s
b: 4 in s: 4000 tobyink :: 0.000158 s
b: 4 in s: 4000 damianc :: 0.000719 s
b: 26 in s: 32 hdb :: 0.000075 s
b: 26 in s: 32 tobyink :: 0.000097 s
b: 26 in s: 32 damianc :: 0.000109 s
b: 26 in s: 260 hdb :: 0.000076 s
b: 26 in s: 260 tobyink :: 0.000153 s
b: 26 in s: 260 damianc :: 0.000124 s
b: 26 in s: 2600 hdb :: 0.000111 s
b: 26 in s: 2600 tobyink :: 0.000152 s
b: 26 in s: 2600 damianc :: 0.000182 s
b: 26 in s: 26016 hdb :: 0.000125 s
b: 26 in s: 26016 tobyink :: 0.000947 s
b: 26 in s: 26016 damianc :: 0.000620 s
b:64000 in s: 100595 hdb :: 0.006378 s
b:64000 in s: 100595 tobyink :: 6.614787 s
b:64000 in s: 100595 damianc :: 6.247666 s
b:64000 in s: 657902 hdb :: 0.017817 s
b:64000 in s: 657902 tobyink :: 48.717781 s
b:64000 in s: 657902 damianc :: 12.516777 s
b:64000 in s: 6444916 hdb :: 0.235547 s
b:64000 in s: 6444916 tobyink :: 582.471826 s
b:64000 in s: 6444916 damianc :: 179.466052 s
b:64000 in s: 64031416 hdb :: 2.763495 s
b:64000 in s: 64031416 tobyink :: 6158.077379 s
b:64000 in s: 64031416 damianc :: 2104.112186 s
{
damianc => {
4 => { 1 => "8.10623168945313e-005", 10 => "0.000266075134277344",
+ 100 => "0.000210046768188477", 1000 => "0.000719070434570313", all =
+> "0.00127625465393066", },
26 => { 1 => "0.000108957290649414", 10 => "0.000123977661132813",
+ 100 => "0.000181913375854492", 1000 => "0.000619888305664063", all =
+> "0.00103473663330078", },
64000 => { 1 => "6.2476658821106", 10 => "12.5167770385742", 100 =
+> "179.466052055359", 1000 => "2104.11218619347", all => "2302.342681
+16951", },
all => "2302.3449921608",
},
hdb => {
4 => { 1 => "8.89301300048828e-005", 10 => "7.00950622558594e-005"
+, 100 => "8.29696655273438e-005", 1000 => "0.000391006469726563", all
+ => "0.000633001327514648", },
26 => { 1 => "7.48634338378906e-005", 10 => "7.60555267333984e-005
+", 100 => "0.000110864639282227", 1000 => "0.000124931335449219", all
+ => "0.000386714935302734", },
64000 => { 1 => "0.006378173828125", 10 => "0.0178170204162598", 1
+00 => "0.235547065734863", 1000 => "2.76349496841431", all => "3.0232
+3722839355", },
all => "3.02425694465637",
},
tobyink => {
4 => { 1 => "0.000335931777954102", 10 => "7.00950622558594e-005",
+ 100 => "9.17911529541016e-005", 1000 => "0.000158071517944336", all
+=> "0.000655889511108398", },
26 => { 1 => "9.70363616943359e-005", 10 => "0.000153064727783203"
+, 100 => "0.000151872634887695", 1000 => "0.000946998596191406", all
+=> "0.00134897232055664", },
64000 => { 1 => "6.61478710174561", 10 => "48.7177810668945", 100
+=> "582.471826076508", 1000 => "6158.07737898827", all => "6795.88177
+323341", },
all => "6795.88377809525",
},
}
I'm not sure why you think it would be any easier to maintain that the non-regex solutions?
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.