bartoszlenar / Validot

Validot is a performance-first, compact library for advanced model validation. Using a simple declarative fluent interface, it efficiently handles classes, structs, nested members, collections, nullables, plus any relation or combination of them. It also supports translations, custom logic extensions with tests, and DI containers.
MIT License
310 stars 19 forks source link

Performance improvement: `IReadOnlyList<string> TranslationNames` -> `IReadOnlySet<string> TranslationNames` #27

Open adambajguz opened 2 years ago

adambajguz commented 2 years ago

Feature description

TranslationNames property is currently impleemented as a read only list of strings. I think it would be better to change it to a read only set (IReadOnlySet<string>) because it allows for a faster checks like Contains, which in my opinion are more important in this context than index-based access to translations.

bartoszlenar commented 2 years ago

Thank you, @adambajguz , for your input. You might be right and although this isn't part of the project that will be under constant pressure, I appreciate that this change is 100% about performance.

I've verified that it could be done relatively straightforward, but I'd need more time to think about possible complications. One of them, naturally, is a version bump to 3.0.0 and that's why this issue will probably wait while along with other breaking changes (to reduce chaos).

bartoszlenar commented 1 year ago

Hi @adambajguz

Since IReadOnlySet isn't a part of .NET Standard 2.0 Validot is now basing on, I'm scheduling this in 2023, as a part of the big update that will change the base to the newest .NET versions.