RepoDB icon indicating copy to clipboard operation
RepoDB copied to clipboard

Cache for mapped property names

Open SergerGood opened this issue 4 years ago • 9 comments

The cache in PropertyCache has been extended to work with case insensitive mappedNames. This made it possible to reduce the search for properties and allocation of memory.

изображение

SergerGood avatar May 10 '21 12:05 SergerGood

oops, I think I broke something

SergerGood avatar May 10 '21 13:05 SergerGood

Hey, it is a nice optimization. Any particular reason why does the test suites fail?

mikependon avatar May 10 '21 13:05 mikependon

Some tests failed. Now I'll see what went wrong

SergerGood avatar May 10 '21 13:05 SergerGood

https://github.com/mikependon/RepoDB/blob/9ec4d8e09a711786d58d27ea1d682e3ef90aa01b/RepoDb/RepoDb.Tests/RepoDb.UnitTests/QueryGroups/QueryGroupParseExpressionClassesTest.cs#L25

https://github.com/mikependon/RepoDB/blob/9ec4d8e09a711786d58d27ea1d682e3ef90aa01b/RepoDb/RepoDb.Tests/RepoDb.UnitTests/QueryGroups/QueryGroupParseExpressionClassesTest.cs#L33

I made a dictionary for the mapped names, but there is a duplicate name here. I think that this is not correct, especially considering the old logic FirstOrDefault

SergerGood avatar May 10 '21 13:05 SergerGood

Mapping calls the PropertyCache at generation time. Therefore, it cannot be called before the mapping itself. I added a separate cache for mappedNames, which is called for individual properties.

SergerGood avatar May 10 '21 15:05 SergerGood

https://github.com/mikependon/RepoDB/blob/9ec4d8e09a711786d58d27ea1d682e3ef90aa01b/RepoDb/RepoDb.Tests/RepoDb.UnitTests/QueryGroups/QueryGroupParseExpressionClassesTest.cs#L25

https://github.com/mikependon/RepoDB/blob/9ec4d8e09a711786d58d27ea1d682e3ef90aa01b/RepoDb/RepoDb.Tests/RepoDb.UnitTests/QueryGroups/QueryGroupParseExpressionClassesTest.cs#L33

I made a dictionary for the mapped names, but there is a duplicate name here. I think that this is not correct, especially considering the old logic FirstOrDefault

What about this?

SergerGood avatar May 10 '21 15:05 SergerGood

https://github.com/mikependon/RepoDB/blob/9ec4d8e09a711786d58d27ea1d682e3ef90aa01b/RepoDb.Core/RepoDb.Tests/RepoDb.IntegrationTests/PropertyHandlerImplicitTest.cs#L50 PropertyHandler Also calls mappedNames during mapping...

SergerGood avatar May 10 '21 19:05 SergerGood

I left the PropertyCache alone. The PropertyHandler logic is designed for the fact that we will iterate over the properties and, accordingly, map them one by one.

So I added the MappedPropertyCache which works with the PropertyCache. And called him in places where you really need to work with mapped properties.

But problem of duplicate name still left. As designed?

SergerGood avatar May 11 '21 18:05 SergerGood

Just to give you updates, I am still reviewing this.

mikependon avatar May 17 '21 10:05 mikependon