Source generator hangs with long target members #479
Closed
TimothyMakkison
started this conversation in
Ideas
Replies: 1 comment 2 replies
-
This does improve with #480, doesn't it? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Mapperly currently uses a slow way of finding matching properties. Most of the time this isnt a problem as$n$ will usually be less than 5. However performance can take a hit when a member contains a lot of capital letters ie:
USERS_UNIQUE_PRINTER_ID
or doesn't have a matching source property.To get the full set of ordered partitions is$O(2^{(n-1)})$ and in a (very unlikely) worse case scenario (lots of types with almost matching members) will generate a lot of concatenated strings see here.
Benchmarks
Benchmarks for generating the Sample project.
CarDto
has a variable length all capital letters member.13 chars
15 chars
16 chars
17 chars
Fixes
This is an uncommon problem, so a warning or diagnostic could be made. Perhaps a check for members with over 10 capital letters.
I did have a couple of ideas for optimizing matching, for both normal complex mappings and worse case scenarios. Unfortunately most would change the order that members are mapped.
Beta Was this translation helpful? Give feedback.
All reactions