With the addition of int_save and int_restore, I decided to test the
matching speed for the regex code I have been playing with. I tested
two versions of the regex matching code with only core ops, one using
the normal stack and one using the integer stack. All other aspects of
the code remained unchanged.

The stack is used heavily during backtracking and the difference in
performance should be greatest in that case.

The following match induces a modest amount of backtracking:

("ab"x10000)."c" =~ /abc/   500 reps

int stack: 8.976033 sec
reg stack: 9.960631
perl:      0.118443


For a pathological regex with nested quantifiers that induces severe
backtracking, we get

"bbbbXcXaaaaaaaaaaaaaaaaaaaa" =~ /.X(.+)+X/  1 rep

int stack: 7.407378 sec
reg stack: 8.415839
perl:      0.000283

In both cases, the integer stack matches faster than the regular stack
by about 11-14%. The very low perl numbers are due to optimizations
not included in my regex code generator.

The integer stack is clearly a win.

    -Mark


Reply via email to