#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.
* Split a segment at a time.
* Use pointers to index over the string.
* Use String Scanner (regex).
The array is always faster. 🤔
Please boost to reach any big brains too busy to follow me. 😉