Skip to content

Conversation

Mpdreamz
Copy link
Member

…ing an Inferrer

Run creates a new PropertyName each time RunCreateOnce only once than does the inferrence a whole bunch of times.

Before

        Method |         Mean |     Error |     StdDev |      Gen 0 |    Allocated |
-------------- |-------------:|----------:|-----------:|-----------:|-------------:|
           Run | 1,001.777 ms | 77.603 ms | 20.1571 ms | 62000.0000 | 192203.37 KB |
 RunCreateOnce |     8.501 ms |  1.670 ms |  0.4338 ms |          - |      4.57 KB |

After

        Method |        Mean |      Error |     StdDev |      Gen 0 |    Allocated |
-------------- |------------:|-----------:|-----------:|-----------:|-------------:|
           Run | 1,147.55 ms | 172.197 ms | 44.7275 ms | 62000.0000 | 192203.37 KB |
 RunCreateOnce |    10.58 ms |   3.117 ms |  0.8096 ms |          - |      4.57 KB |

Since the caches are per ConnectionSettings and not per Inferrer this has no noticable performance boost nor implications for 5.x but is still cleaner.

Copy link
Contributor

@russcam russcam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

internal static Func<object, object> MakeDelegate<T, TReturn>(MethodInfo @get)
{
var f = (Func<T, U>)@get.CreateDelegate(typeof(Func<T, U>));
var f = (Func<T, TReturn>)@get.CreateDelegate(typeof(Func<T, TReturn>));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++ for clearer generic parameter names

var infer = new Inferrer(nestSettings);
return infer.PropertyName(this);

return nestSettings?.Inferrer.PropertyName(this);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch 👍

@russcam russcam merged commit afdeb02 into master Jan 15, 2018
@russcam
Copy link
Contributor

russcam commented Jan 15, 2018

pulled this in @Mpdreamz

russcam added a commit that referenced this pull request Jan 15, 2018
@russcam
Copy link
Contributor

russcam commented Jan 15, 2018

backported to 5.x (reinstated exception throwing in string IUrlParameter.GetString(IConnectionConfigurationValues settings) on PropertyName

@russcam russcam deleted the fix/property-name-infer branch January 15, 2018 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants