4 ms·
Recently ran into this where we wanted to avoid new URL for the memory overhead, and was blown away that JavaScript's URL does not contain a static parse method
by ramesh31 2y ago
Recently ran into this where we wanted to avoid new URL for the memory overhead, and was blown away that JavaScript's URL does not contain a static parse method. Things like this are why people working with real languages make fun of us.
- unchar1 2y agoWouldn't a static parse method still allocate memory for the object that it returns?
- ramesh31 2y ago> Wouldn't a static parse method still allocate memory for the object that it returns? Yes, but you don't have the overhead of constructing URL first. The new URL.canParse method from the article covers this.