Toot

Written by Damian C. Rossney on 2025-01-30 at 02:50

[#]Ruby perf question: What's the fastest way to iterate over segments in an HTTP route? (ex. "/users/:id/postst/:post_id")

I currently .split on "/" and call .each on the array. I thought I could avoid creating an array and perhaps gain speed by "consuming" the string directly. I tried three ways.

The array is always faster. 🤔

Please boost to reach any big brains too busy to follow me. 😉

=> View attached media | View attached media | View attached media | View attached media

=> More informations about this toot | View the thread | More toots from dcrossney@ruby.social

Mentions

Tags

=> View ruby tag

Proxy Information
Original URL
gemini://mastogem.picasoft.net/toot/113915030807953673
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
311.023414 milliseconds
Gemini-to-HTML Time
0.495898 milliseconds

This content has been proxied by September (3851b).