in reply to Substitution unexpectedly very slow, in Strawberry

Still occurs with Strawberry Perl 5.36.1 and 5.38.0 (see below) although I suspect it is more generic than Strawberry Perl.

Running the code through nytprof shows 1000001 calls to main::CORE:substcont at line 10 take most of the time.

It does not happen when the $x repetition is set to 1e5. There was a possibly related thread here a few months ago about character repetitions and COW but I can't locate it right now.

0.224835157394409 0.228233814239502 v5.22.3 9.92650699615479 0.662662982940674 v5.28.0 8.49285101890564 0.744230985641479 v5.36.1 8.02936911582947 0.788676977157593 v5.38.0