-
Notifications
You must be signed in to change notification settings - Fork 410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make shared compstates copy cloneable types #5459
base: master
Are you sure you want to change the base?
Make shared compstates copy cloneable types #5459
Conversation
Sometimes you can get trolled by stuff like autonetworked dictionaries not being copied on the client so you get mispredicts. Downside is this allocates on server so not sure if we can just compile this out on server or what.
getStateInit.Append($@" | ||
{name} = new(component.{name}),"); | ||
} | ||
else | ||
{ | ||
getStateInit.Append($@" | ||
{name} = component.{name} == null ? null : new(component.{name}),"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only the client should have to clone for get-state (and it would only ever have to do so once per comp).
So this should somehow check is-server/is-client to avoid allocs.
And for fixture sys, its easy to manually add the checks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't debug sourcegen code coz my IDE blows up but not sure if I can just get the assembly or what, I'll see if I can figure something out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I ended up using FULL_RELEASE but somehow it blows up tests. I think on an actual server it probably doesn't matter for getstate? Alternatively I use an msbuild property like pjb said.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think FULL_RELEASE gets communicated properly to source gens? I'd rather have this relying on a compile property dynamically isnide the source gen.
Sometimes you can get trolled by stuff like autonetworked dictionaries not being copied on the client so you get mispredicts.
Downside is this allocates on server so not sure if we can just compile this out on server or what.