-
Notifications
You must be signed in to change notification settings - Fork 192
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
omitempty has no effect when node complexity exceeds inlining threshold #381
Comments
type Flobbity struct {
A Flobs `msg:"a,omitempty"`
B Flobs `msg:"b,omitempty"`
}
type Flobs []Flob It would seem that the problem is that the When we bung in the I will try to rephrase the bug subject line. |
When considering inlining maps/slices/arrays, apply a fixed cost and ignore the cost of the children. If children are too expensive, they will not be inlined, but it shouldn't affect whether the map itself is inlined. This only really applies when a map or slice type is aliased, otherwise it will not be considered for inlining. Fixes tinylib#381
Looked a bit back and forth, and it seems like the simplest solution is also the best - don't consider the cost of the children when deciding if these aliases types should be inlined. Proposed fix in #382 |
Thank you for publishing this lovely library. :)
This bug smells similar to #376. It is so similar that I did double check I was on trunk before sending this bug report.
The following input works as expected.
Flibbity.MarshalMsg
includes the omitempty tests.The following input demonstrates the problem.
Flobbity.MarshalMsg
is missing the omitempty tests.Curiously, if we remove either one of
A
orB
from the type definition ofFlobbity
, the second example also begins to work as expected.Here is a repository with the sources above.
https://github.com/saj/tinylib-msgp-381
The text was updated successfully, but these errors were encountered: