-
-
Notifications
You must be signed in to change notification settings - Fork 742
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
perf: replace isValueType with faster alternative #1617
Conversation
Kudos, SonarCloud Quality Gate passed! 0 Bugs |
@paulpach why do we still need the check? |
All our messages are value type, but there is no guarantee/requirement that messages are value types. In fact our documentation teaches people to use classes because they happen to be more convenient. With classes you don't have to add an empty Serialize and Deserialize method. This PR should fix the problem though |
did you profile it already? |
According to vis benchmark here #1614 (comment) isValueType is an expensive operation. This microoptimization replaces isValueType for a faster (not so readable) alternative
profiling, hang in there... |
## [29.0.3](29.0.2-master...29.0.3-master) (2020-03-28) ### Performance Improvements * faster NetworkWriter pooling ([#1616](https://github.com/MirrorNG/MirrorNG/issues/1616)) ([5128b12](5128b12)), closes [#1614](https://github.com/MirrorNG/MirrorNG/issues/1614) * replace isValueType with faster alternative ([#1617](https://github.com/MirrorNG/MirrorNG/issues/1617)) ([61163ca](61163ca)), closes [/github.com/MirrorNetworking/Mirror/issues/1614#issuecomment-605443808](https://github.com//github.com/vis2k/Mirror/issues/1614/issues/issuecomment-605443808) * use byte[] directly instead of MemoryStream ([#1618](https://github.com/MirrorNG/MirrorNG/issues/1618)) ([166b8c9](166b8c9))
According to vis benchmark here MirrorNetworking/Mirror#1614 (comment) isValueType is an expensive operation. This microoptimization replaces isValueType for a faster (not so readable) alternative
## [29.0.3](29.0.2-master...29.0.3-master) (2020-03-28) ### Performance Improvements * faster NetworkWriter pooling ([#1616](https://github.com/MirrorNG/MirrorNG/issues/1616)) ([5128b12](5128b12)), closes [#1614](https://github.com/MirrorNG/MirrorNG/issues/1614) * replace isValueType with faster alternative ([#1617](https://github.com/MirrorNG/MirrorNG/issues/1617)) ([61163ca](61163ca)), closes [/github.com/MirrorNetworking/Mirror/issues/1614#issuecomment-605443808](https://github.com//github.com/vis2k/Mirror/issues/1614/issues/issuecomment-605443808) * use byte[] directly instead of MemoryStream ([#1618](https://github.com/MirrorNG/MirrorNG/issues/1618)) ([166b8c9](166b8c9))
According to vis benchmark in #1614
isValueType is an expensive operation.
This micro-optimization replaces isValueType for a faster (not so readable) alternative