Skip to content
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

Remove memoization on encode #305

Merged
merged 1 commit into from
Feb 19, 2016
Merged

Remove memoization on encode #305

merged 1 commit into from
Feb 19, 2016

Conversation

liveh2o
Copy link
Contributor

@liveh2o liveh2o commented Feb 18, 2016

Changing values in repeated fields does not clear the memoized encoded value. This means that changes to repated fields after the memoized encoding has been computed will never be encoded. The pattern works for other field types because the memoized value is being cleared in the setter on the message before we call into the field. The field itself is not involved in clearing the memoized value at all.

Repeated fields are a different story. If we were completely resetting a repeated field to a new array, the memoized encoding would be correctly cleared, but because the field array we are pushing into doesn't have any concept of a message, let alone the specific message instance the field belongs to, there is no way to clear the memoized encoded message.

We need to remove the memoization until we can find a better approach.

Fixes #304.

// @film42 @abrandoned @goddardc

Changing values in repeated fields does not clear the memoized encoded
value. This means that changes to repated fields after the memoized
encoding has been computed will never be encoded. The pattern works for
other field types because the memoized value is being cleared in the
setter on the message before we call into the field. The field itself is
not involved in clearing the memoized value at all.

Repeated fields are a different story. If we were completely resetting a
repeated field to a new array, the memoized encoding would be correctly
cleared, but because the field array we are pushing into doesn't have any
concept of a message, let alone the specific message instance the field
belongs to, there is no way to clear the memoized encoded message.

We need to remove the memoization until we can find a better approach.

Fixes #304.
@film42
Copy link
Member

film42 commented Feb 19, 2016

Restarted the job, not sure why some of these things were failing (looks vm specific). I agree, we're going to need to attack this in a different way.

@liveh2o
Copy link
Contributor Author

liveh2o commented Feb 19, 2016

Yeah, the one you restarted failed as well. Ran it a third time and things are now passing! Ready for review.

@film42
Copy link
Member

film42 commented Feb 19, 2016

:shipit:

liveh2o added a commit that referenced this pull request Feb 19, 2016
@liveh2o liveh2o merged commit 45a2fb1 into master Feb 19, 2016
@liveh2o liveh2o deleted the ah/revert_memoize_on_encode branch February 19, 2016 04:38
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