in reply to Re^4: Benchmarking "Are all these characters in this sentence?" (quickest yet?)
in thread Benchmarking "Are all these characters in this sentence?"
Of course, we can then apply the so called "micro optimisations" to that:
buk2 => sub { local $_; 1+index $_[0], $_ or return while $_ = chop $_[1]; 1; },
Though the results of doing so can hardly be called "micro" when they result in an order of magnitude speed up over the non-optimised equivalent; 15 times faster than the next best; and 60 times faster than the original!
c:\test>707621.pl Running benchmarks... Short Rate tallulah_OriginalPost unpack_allrindex un +pack_allindex repellent_unpack tye2 tye1 tye0 buk buk2 tallulah_OriginalPost 41.4/s -- -80% + -80% -89% -92% -92% -93% -96% -98% unpack_allrindex 206/s 396% -- + -3% -47% -59% -59% -67% -80% -92% unpack_allindex 212/s 413% 3% + -- -46% -57% -57% -65% -80% -92% repellent_unpack 391/s 844% 90% + 84% -- -21% -21% -36% -63% -85% tye2 498/s 1102% 142% + 134% 27% -- -0% -19% -53% -80% tye1 498/s 1102% 142% + 134% 27% 0% -- -19% -53% -80% tye0 614/s 1382% 199% + 189% 57% 23% 23% -- -42% -76% buk 1052/s 2439% 411% + 395% 169% 111% 111% 71% -- -58% buk2 2529/s 6004% 1129% + 1090% 546% 408% 408% 312% 140% -- LongShort Rate tallulah_OriginalPost unpack_allrindex un +pack_allindex repellent_unpack tye1 tye2 tye0 buk buk2 tallulah_OriginalPost 64.0/s -- -75% + -75% -88% -91% -91% -94% -96% -99% unpack_allrindex 258/s 303% -- + -0% -52% -63% -63% -75% -82% -95% unpack_allindex 259/s 305% 0% + -- -52% -63% -63% -75% -82% -95% repellent_unpack 540/s 744% 109% + 108% -- -22% -23% -48% -63% -89% tye1 694/s 985% 169% + 168% 29% -- -1% -33% -52% -85% tye2 703/s 998% 172% + 171% 30% 1% -- -33% -51% -85% tye0 1043/s 1529% 304% + 302% 93% 50% 48% -- -28% -78% buk 1449/s 2164% 462% + 459% 168% 109% 106% 39% -- -69% buk2 4740/s 7307% 1737% + 1728% 778% 583% 574% 355% 227% -- ShortLong (warning: too few iterations for a reliable count) Rate tallulah_OriginalPost repellent_unpack un +pack_allindex unpack_allrindex tye0 tye1 tye2 buk buk2 tallulah_OriginalPost 1.01/s -- -82% + -82% -83% -95% -95% -95% -97% -100% repellent_unpack 5.57/s 452% -- + -3% -6% -71% -72% -72% -86% -99% unpack_allindex 5.73/s 468% 3% + -- -3% -70% -71% -71% -86% -99% unpack_allrindex 5.91/s 486% 6% + 3% -- -69% -70% -70% -85% -99% tye0 19.1/s 1794% 243% + 233% 223% -- -4% -4% -53% -97% tye1 19.8/s 1865% 256% + 246% 235% 4% -- -1% -51% -97% tye2 20.0/s 1878% 258% + 248% 237% 4% 1% -- -50% -97% buk 40.2/s 3888% 623% + 602% 580% 111% 103% 102% -- -93% buk2 607/s 60074% 10804% + 10490% 10167% 3077% 2962% 2942% 1409% -- LongLong (warning: too few iterations for a reliable count) Rate tallulah_OriginalPost repellent_unpack un +pack_allindex unpack_allrindex tye0 tye2 tye1 buk buk2 tallulah_OriginalPost 1.07/s -- -81% + -81% -81% -94% -94% -95% -97% -100% repellent_unpack 5.49/s 415% -- + -3% -4% -71% -72% -72% -86% -99% unpack_allindex 5.65/s 430% 3% + -- -1% -70% -71% -71% -86% -99% unpack_allrindex 5.73/s 437% 4% + 1% -- -70% -70% -71% -86% -99% tye0 19.0/s 1681% 246% + 236% 232% -- -1% -3% -53% -97% tye2 19.3/s 1708% 251% + 241% 237% 1% -- -2% -52% -97% tye1 19.7/s 1745% 259% + 248% 244% 4% 2% -- -51% -97% buk 40.4/s 3687% 636% + 615% 606% 113% 109% 105% -- -93% buk2 592/s 55368% 10678% + 10372% 10234% 3014% 2969% 2906% 1365% -- VeryLong Rate tallulah_OriginalPost unpack_allrindex u +npack_allindex repellent_unpack tye1 tye2 tye0 buk buk2 tallulah_OriginalPost 70.5/s -- -85% + -85% -90% -91% -92% -92% -96% -99% unpack_allrindex 469/s 565% -- + -0% -33% -42% -48% -49% -71% -96% unpack_allindex 470/s 567% 0% + -- -32% -42% -48% -49% -71% -96% repellent_unpack 696/s 888% 48% + 48% -- -14% -22% -25% -57% -95% tye1 813/s 1053% 73% + 73% 17% -- -9% -12% -49% -94% tye2 897/s 1173% 91% + 91% 29% 10% -- -3% -44% -93% tye0 923/s 1210% 97% + 96% 33% 14% 3% -- -42% -93% buk 1604/s 2176% 242% + 241% 130% 97% 79% 74% -- -87% buk2 12775/s 18020% 2624% + 2616% 1734% 1471% 1324% 1283% 696% --
|
|---|