andywilsonuk / StringTokenFormatter

Provides string extension methods for replacing tokens within strings (using the format '{name}') with their specified lookup value.
Apache License 2.0
37 stars 1 forks source link

FrozenDictionaryTokenValueContainer #33

Closed TonyValenti closed 8 months ago

TonyValenti commented 11 months ago

@andywilsonuk - Can you add one that conditionally becomes available if the target framework is 8.0 or greater?

FrozenDictionaries are super fast post-construction.

andywilsonuk commented 11 months ago

Good shout, I'll check it out.

andywilsonuk commented 9 months ago

@TonyValenti I added this in v8 but it's opt in at the moment because from the benchmarks I've seen there's a hit to creating the dictionary and only by re-using the container will the read benefit be realised. Any thoughts on this?

TonyValenti commented 9 months ago

Hi Andy, I haven't looked at V8 yet, but in general, I would recommend having its own container, so I can explicitly choose to use frozen dictionary. You are correct that it is slower, but it is so much faster!

andywilsonuk commented 8 months ago

Nothing new has been discovered so I'll close this.