JsonLdProcessor.Frame(...): poor performance on large sets of objects
Closed this issue · 2 comments
Version 1.0.4
From http://www.w3.org/TR/json-ld-api/#node-map-generation:
6.6.6.2) Otherwise, compare reference against every item in the array associated with the active property member of node. If there is no item equivalent to reference, append reference to the array. Two JSON objects are considered equal if they have equivalent key-value pairs.
This is implemented in json-ld.net as an n-squared algorithm, where n is the number of elements in the set. JsonLdProcessor.Frame(...) calls JsonLdApi.GenerateNodeMap(…), which for each element in an array calls JsonLdUtils.MergeValue(…), which in turn calls JsonLdUtils.DeepCompare(…) on the current set.
Repro: build and run this project: JsonLdRepro.zip
This should be considered in connection with #60