4 ms·
I've been thinking that FST could be well suited for building routers for web frameworks. I.e. matching request path `/foo/42` to a set of route patterns like `
by zokier 1y ago
I've been thinking that FST could be well suited for building routers for web frameworks. I.e. matching request path `/foo/42` to a set of route patterns like `/foo/{id}` etc. As I understand FST should be near perfect for this use and could potentially allow very good performance. Especially if you can construct the FST at compile time. Somewhat surprisingly I haven't seen anyone doing anything in that direction though, and FST literature is bit difficult if you don't have formal NLP background
- rickette 1y agoRadix Trees are (often?) used for this purpose, for example in Chi: https://github.com/go-chi/chi https://github.com/go-chi/chi. Coincidentally FSTs and Radix trees share some similarities.
- woodruffw 1y ago> Coincidentally FSTs and Radix trees share some similarities Indeed -- I think a useful way to comprehend FSTs is as a radix/prefix trie that also allows suffix compaction. There's probably a formal correlation proof between the two, but I don't know it off the top of my head.