cocur/slugify — pull request #42 by ivoba (2014-09-10 08:29:49+00:00)
Title: [proposal] added SlugMap

I introduced a slugMap to Slugify, which is checked before the actual strtr replacement, if set.

The slugMap can contain full strings instead of single chars as in ruleMaps.

The main use case was Performance: in pages that have lots of slugify occurences, for whatever reason, one could fill the map from a cache instance, which is probably faster than to run strtr a hundred times. I had evidence here while profiling, but need to prove this with a benchmark, though.

I used to do this in a SlugifyProxy class, but maybe this is generic enough.