-
Notifications
You must be signed in to change notification settings - Fork 11
Consider StringBuilder to build request URLs #64
Comments
Or UriBuilder which seems to be appropriate for url manipulation. |
intantiating a new string builder won't be cheap either though. It'll also have to be collected just like string but probably even more costly. Maybe we can do some tricky stuff like having a static string builder in the IFileSource but such tricks are generally more prone/easier to introduce new bugs. Skeet's article about string concetination; http://jonskeet.uk/csharp/stringbuilder.html |
@brnkhy I read that just 3 separate concatenation statements justify the cost of the string builder object. That said, I was wondering how well a static string builder would work . . . Go through and count how many concatenations happen to format just one URL. This is non-trivial if you want a performant slippy map. |
@david-rhodes admittedly I'm not sure what to do about these stuff these days considering that they already announced .net 4.6 for unity. i.e. unity will be getting async programming with that, which might be the best replacement for |
We have loads of string manipulation happening throughout the SDK to format request URLs. Because strings are immutable, this is creating lots of garbage for each request. I'm guessing each request uses 20+ temporary strings. Request 128 tiles and now you have problems.
Solution: use
StringBuilder
(and dependency injection?)The text was updated successfully, but these errors were encountered: