Skip to content

Conversation

@dbu
Copy link
Contributor

@dbu dbu commented Jan 8, 2019

when a query yields a large response, duplicating the data between string and parsed array duplicates the memory consumption.
once $this->_response is set, $this->_responseString is not accessed anywhere in the code anymore.

@p365labs
Copy link
Collaborator

p365labs commented Jan 8, 2019

@dbu that's really interesting.. I've had a look at the code and _responseString is never accessed after the use in getData(). Does it really created a problem in memory consumption ? Glad that you discovered it, maybe this could save life to lot of people :) Do you think that this could be the only way to solve it ?

@dbu
Copy link
Contributor Author

dbu commented Jan 8, 2019

we have queries where the raw json is several megabytes, so yes, duplicating that is a cost.

another option would be to parse in the constructor and never even set the raw string. that would mean a performance penalty if the result is not used at all, not sure if that is likely to happen. might be for changing requests that the http status is enough to know it worked...

this change looked like the smallest impact where we can be sure there is no negative side effect in any circumstate.

@p365labs
Copy link
Collaborator

p365labs commented Jan 8, 2019

I agree with you. I think we can proceed this way right now. @ruflin what do you think on this ?

@ruflin
Copy link
Owner

ruflin commented Jan 9, 2019

👍 on the change. A changelog entry would be nice.

when a query yields a large response, duplicating the data between string and parsed array duplicates the memory consumption.
once $this->_response is set, $this->_responseString is not accessed anywhere in the code anymore.
@dbu
Copy link
Contributor Author

dbu commented Jan 9, 2019

added a changelog entry. ok like this?

Copy link
Owner

@ruflin ruflin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, assuming CI goes green ;-)

@p365labs p365labs merged commit 924c8f9 into ruflin:master Jan 9, 2019
@dbu dbu deleted the patch-1 branch January 9, 2019 14:37
ruflin pushed a commit that referenced this pull request Jan 10, 2019
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.

3 participants