in reply to Re^2: Masking part of a string
in thread Masking part of a string

A relevant benchmark would factor in the time to build the mask while preserving the real application's ratio of mask rebuilds to the number of operations found. Right now, you ignore the time to build the mask in two tests, while including it in the third test.

Depending on that ratio, substrList is faster than andOrAndNot.

Replies are listed 'Best First'.
Re^4: Masking part of a string
by johngg (Canon) on Jun 27, 2007 at 16:20 UTC
    Yes, changing the benchmark to rebuild the mask for each operation does show substrList coming out on top. Here's the amended code (I hope I've got it right this time)

    and the output

    Rate andRegex andOrAndNot substrList andRegex 12.8/s -- -43% -50% andOrAndNot 22.6/s 77% -- -11% substrList 25.4/s 99% 12% --

    Cheers,

    JohnGG