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
Limiting data copy in xmlrpclib #45148
Comments
Data going through the xmlrpclib are copied many times in Python. This creates problem when submitting blob of data in XML-RPC (I know the protocol is not aimed for that, but sometimes it's useful). This little patch try to limit memory usage of xmlrpclib by adding a few optimizations. I did the patch on Python 2.4 because it's what our customer is using, but it should work on Python 2.5 or more recent too. |
The code in the patch has been removed from py3k. This can only go forward if a unit test is provided. Change assigned to as per maintainers list. |
Martin has recently removed his name from py3k/Misc/maintainers.rst. |
Could somebody update here please http://svn.python.org/view/*checkout*/python/branches/py3k/Misc/maintainers.rst |
Adapted the patch to python3.3 |
Well, str.join() already optimizes this case to avoid copies: >>> s = "x" * 50
>>> id(s)
139712615414000
>>> id(''.join([s]))
139712615414000 |
I would close this as out of date, unless you have other suggestions to improve memory consumption. |
Great that join does the optimisation by itself now, but the last issue of the patch (cleaning the _data array before calling f() so the memory of _data can be collected earlier) still seems meaningful today. |
I removed the unnecessary check on single-element arrays. |
Do you have any benchmarks? |
It's not something that can be easily benched because it depends a lot of the use case. If some conditions are present (big amount of data sent to XML-RPC, the XML-RPC server taking a long time to answer, end either Python giving back the memory to the OS or another thread reusing the garbage collected memory) the gain in memory can be very significant, in most other cases, it won't change anything. Do you me to craft a simple example where the difference can be seen ? |
Yes, it would be nice if you provided an example. |
Apart from this being abandoned for 9 years, the change proposed here is only valid if end() is only called once. Is this guaranteed? I can't find anything about this in the doc. I suggest we close the issue. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: