Reduce patch applying cost.
Let the developer to decide does he wants to modify same object or copy of it. In other way test operation produces huge overhead for nothing.
This commit is contained in:
@@ -39,7 +39,6 @@ __website__ = 'https://github.com/stefankoegl/python-json-patch'
|
||||
__license__ = 'Modified BSD License'
|
||||
|
||||
|
||||
import copy
|
||||
import json
|
||||
|
||||
|
||||
@@ -85,9 +84,7 @@ class JsonPatch(object):
|
||||
|
||||
|
||||
def apply(self, obj):
|
||||
""" Applies the patch to a copy of the given object """
|
||||
|
||||
obj = copy.deepcopy(obj)
|
||||
""" Applies the patch to given object """
|
||||
|
||||
for operation in self.patch:
|
||||
op = self._get_operation(operation)
|
||||
|
||||
Reference in New Issue
Block a user