Open
Description
Hi,
I have been using JSON-merge in my projects for while now. It has been working great.
I've recently started using it in a new project where I update/merge multiple JSON documents
every few seconds. Since these changes, the CPU utilization for my app has gone up
considerably. I've profiled my code and narrowed it down. JsonMerge call seems to
be causing most of the spike. I have tried different merging strategies etc, but I have
not made any progress in reducing the CPU consumption. Any suggestions on how I
could go about reducing the CPU consumption of JSON-merge? Any pointers is
greatly appreciated. Thanks.
PS: my default merging strategy.
merge_schema = """
{
"oneOf": [
{ "type": "string" },
{ "type": "number" },
{ "type": "boolean" },
{
"type": "array",
"mergeStrategy": "arrayMergeById",
"mergeOptions": {"idRef": "/"}
},
{
"type": "object",
"additionalProperties": { "$ref": "#" }
}
]
}
"""
def JsonMerge(base, new_obj):
schema = json.loads(merge_schema)
merger = Merger(schema)
return merger.merge(base, new_obj, schema)
Metadata
Metadata
Assignees
Labels
No labels