Improve the performance of HostingServiceClient._build_form_data
Review Request #8910 — Created April 21, 2017 and submitted — Latest diff uploaded
The method in question was doing multiple string concatenations with
+=
, which is very inefficient for large number of operations becuase
each operation results in a memory allocation. We now build a single
string with string interpolation for each field and file passed in and
join all the blobs together, which will require only a single memory
allocation for the final string, instead ofO(|fields| + |files|)
allocations.
Ran unit tests.
Diff Revision 1
This is not the most recent revision of the diff. The latest diff is revision 3. See what's changed.
orig
1
2
3
reviewboard/hostingsvcs/service.py |
---|