Почему генерация слагов замедляется с увеличением количества заголовков
DEV · 17.11.2026 · 23:55
В статье рассматриваются два метода преобразования заголовков в URL-слаги и их производительность при различных объемах данных. Оба метода показали идентичные результаты, но время обработки…
Оригинал
Why Slug Generation Gets Slower the More Titles You Feed It
I benchmarked two ways to turn a title into a URL slug, across 1,000 to 20,000 titles A single chained-regex version took 62.77ms at 20,000 titles, a manual character-loop version took 32.74ms on the same input Below 1,000 titles the two were close enough to call a tie, roughly 7ms versus 6.4ms Both produced identical slugs on every title I tested, including ones with accents, so correctness was never the question Every product, every blog post, every page on a Shopify store eventually needs a