Joshua Isom (via RT) wrote:


For the reverse-compliment benchmark, I've gotten it working(albeit not well), but with one major caveat. Since, to my knowledge, parrot has no equivalent of perl's tr///,

We will need tr///, if we want that benchmark complete in reasonable time.

.. I implemented it using in place substitutions with substr. Sometimes I get parrot to panic and quit(and might I add that the error message is pretty fixed from my look at the code), but other times it's able to keep going.

Ugly. COW ping pong is the problem.

We have:

   $S1 = substr $S0, j, 1

that creates a COW copy of length 1 and sets the COW flag on both strings, because these strings are sharing the same body.

Then inside Switch():

   substr $S0, j, i, .to

This has to modiy the string $S0 in place, therefore it creates an un-COWed new body by reallocationg it.

I've no fast solution for that problem directly just a better workaround:

Instead of the first substr, use

  ch = ord $S0, j

ans use the INTVAL value inside .from and as the left argument to Switch. You should also avoid the extra $S0 copy and just work inside 'line' and substr in width chunks just for printing.

leo

Reply via email to