Please sign in to comment.
[src/core/Cool-str.pm] 500% speedup of .trans
Keep a hash with the next index of each substring to be substituted, and then pick the smallest one through each iteration. (Or, more informally, "skip the boring parts".) This makes the number of iterations through the main loop proportional to the number of substitutions actually made.
- Loading branch information...