optimization idea

Gaspard Bucher gasp... at teti.ch
Wed Feb 27 09:32:53 UTC 2008


When there is a bug regex, we end up with huge switch statements. From
what I understand from these statements, in the worst case, the
process must execute every instruction of type (jump not equal).

We could reduce this by implementing a simple binary tree when the
case statements get too big:

if (cs < 500) {
  if (cs < 250) {
    ...
   } else {
    ...
   }
} else {
  if (cs < 750) {
    ...
  } else {
    ...
  }
}

Is this stupid ?

Gaspard



More information about the ragel-users mailing list