)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"46171cbb106c190c1cb38a6d2557e9eb167c02f7","unresolved":false,"context_lines":[{"line_number":14,"context_line":""},{"line_number":15,"context_line":"That unnecessary work shows up quite significantly in the"},{"line_number":16,"context_line":"_consolidate_allocation_requests method in allocation_candidate.py where"},{"line_number":17,"context_line":"AllocationRequestResource objects get copied, alot. The use of __copy__"},{"line_number":18,"context_line":"more than halves the time consume by _consolidate_allocation_requests."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"There is another copy.copy, in _alloc_candidates_single_provider in the"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"7faddb67_8d92099f","line":17,"range":{"start_line":17,"start_character":46,"end_line":17,"end_character":50},"updated":"2019-08-08 15:10:13.000000000","message":"a lot","commit_id":"50fe7a4cb4113d0cc13be9eb313d8e477042a42f"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"46171cbb106c190c1cb38a6d2557e9eb167c02f7","unresolved":false,"context_lines":[{"line_number":15,"context_line":"That unnecessary work shows up quite significantly in the"},{"line_number":16,"context_line":"_consolidate_allocation_requests method in allocation_candidate.py where"},{"line_number":17,"context_line":"AllocationRequestResource objects get copied, alot. The use of __copy__"},{"line_number":18,"context_line":"more than halves the time consume by _consolidate_allocation_requests."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"There is another copy.copy, in _alloc_candidates_single_provider in the"},{"line_number":21,"context_line":"same file, this time copying AllocationRequest objects. This is only"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"7faddb67_4d8c117f","line":18,"range":{"start_line":18,"start_character":26,"end_line":18,"end_character":33},"updated":"2019-08-08 15:10:13.000000000","message":"consumed","commit_id":"50fe7a4cb4113d0cc13be9eb313d8e477042a42f"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"46171cbb106c190c1cb38a6d2557e9eb167c02f7","unresolved":false,"context_lines":[{"line_number":22,"context_line":"done when a shared provider is involved, and we haven\u0027t been doing scale"},{"line_number":23,"context_line":"testing for those (yet) but since we\u0027re in that domain I\u0027ve gone ahead"},{"line_number":24,"context_line":"and pre-emptively added a __copy__ to that object too, to prepare for"},{"line_number":25,"context_line":"the eventually work of many shared disks."},{"line_number":26,"context_line":""},{"line_number":27,"context_line":"Change-Id: I3e8167e5d09aeb2ae68282bc0378bee6d956a286"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"7faddb67_6dda2d7a","line":25,"range":{"start_line":25,"start_character":4,"end_line":25,"end_character":14},"updated":"2019-08-08 15:10:13.000000000","message":"eventual","commit_id":"50fe7a4cb4113d0cc13be9eb313d8e477042a42f"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"d2883e190b4ff2025ec64eb3be4d06b86fcf0a35","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Add __copy__ method to AllocationRequest{,Resource}"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"It turns out that when Python runs copy.copy on an object it does"},{"line_number":10,"context_line":"a lot of unnecessary work that can be avoided by implementing a"},{"line_number":11,"context_line":"__copy__ method that essentially does a clone(), creating a new"},{"line_number":12,"context_line":"object with the same values. This is considered the idiomatic form"},{"line_number":13,"context_line":"of clone."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"7faddb67_0c3e09da","line":10,"updated":"2019-08-09 13:13:51.000000000","message":"interesting finding.\n\nBut true:\n\n  # with the current patch\n  (py27) ebalgib@elx782184rq:~/upstream/git/placement$ python -m timeit \u0027from placement.objects import allocation_candidate; import copy; ar \u003d allocation_candidate.AllocationRequest(); copy.copy(ar)\u0027\n  10 loops, best of 3: 2.91 usec per loop\n\n  # without the current patch\n  (py27) ebalgib@elx782184rq:~/upstream/git/placement$ python -m timeit \u0027from placement.objects import allocation_candidate; import copy; ar \u003d allocation_candidate.AllocationRequest(); copy.copy(ar)\u0027\n  10 loops, best of 3: 7.92 usec per loop\n\n  # I measured similar difference with python 3.7","commit_id":"1a7d39beed138406267d214580ba07c255fccd62"}],"placement/objects/allocation_candidate.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"46171cbb106c190c1cb38a6d2557e9eb167c02f7","unresolved":false,"context_lines":[{"line_number":241,"context_line":"                     self.amount))"},{"line_number":242,"context_line":""},{"line_number":243,"context_line":"    def __copy__(self):"},{"line_number":244,"context_line":"        # This is shallow copy, so resource_provider and resource_class are"},{"line_number":245,"context_line":"        # the same objects as prior to the copy."},{"line_number":246,"context_line":"        return self.__class__("},{"line_number":247,"context_line":"            resource_provider\u003dself.resource_provider,"}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_6dc30d8c","line":244,"range":{"start_line":244,"start_character":57,"end_line":244,"end_character":71},"updated":"2019-08-08 15:10:13.000000000","message":"pretty sure this is just a string, but meh","commit_id":"50fe7a4cb4113d0cc13be9eb313d8e477042a42f"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"21b4df4980368055be40f7deaa56467038f1cfb4","unresolved":false,"context_lines":[{"line_number":241,"context_line":"                     self.amount))"},{"line_number":242,"context_line":""},{"line_number":243,"context_line":"    def __copy__(self):"},{"line_number":244,"context_line":"        # This is shallow copy, so resource_provider and resource_class are"},{"line_number":245,"context_line":"        # the same objects as prior to the copy."},{"line_number":246,"context_line":"        return self.__class__("},{"line_number":247,"context_line":"            resource_provider\u003dself.resource_provider,"}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_2d00b5ab","line":244,"range":{"start_line":244,"start_character":57,"end_line":244,"end_character":71},"in_reply_to":"7faddb67_6dc30d8c","updated":"2019-08-08 15:13:10.000000000","message":"Oh yeah, I think you\u0027re right, in which case I reckon I should fix this. Will do.","commit_id":"50fe7a4cb4113d0cc13be9eb313d8e477042a42f"}]}
