http://www.perlmonks.org?node_id=542164

creamygoodness has asked for the wisdom of the Perl Monks concerning the following question:

I know this isn't legal perlapi, but I want to run a regex from XS.

This code may be a bottleneck and I'd like to see how much of one it is.

# accumulate token start_offsets and end_offsets my ( @starts, @ends ); 1 while ( m/$separator_re/g and push @starts, pos and m/$token_re/g and push @ends, pos );

I know that doesn't look like it'll gain much from going to XS, but this app has to deal with gobs and gobs of tokens.

What's the hack?

--
Marvin Humphrey
Rectangular Research ― http://www.rectangular.com