You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JsonLD.Core.JsonLdUtils.DeepCompare(...) has poor performance when comparing large arrays. With the provided repro (below) it takes ~4 seconds to perform a deep comparison on two objects.
Repro:
using System;
using System.Diagnostics;
using System.IO;
using System.Net;
using JsonLD.Core;
using Newtonsoft.Json.Linq;
class Program
{
private static void Main()
{
try
{
Test();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
private static void Test()
{
var uri = new Uri("https://az635243.vo.msecnd.net/v3-catalog0/data/2018.06.27.19.19.02/test20180627163712.1.0.485.json");
var request = WebRequest.CreateHttp(uri);
JToken token1;
JToken token2;
using (var response = request.GetResponse())
using (var stream = response.GetResponseStream())
using (var reader = new StreamReader(stream))
{
var json = reader.ReadToEnd();
token1 = JObject.Parse(json);
token2 = JObject.Parse(json);
}
Test(() => JsonLdUtils.DeepCompare(token1, token2), times: 10);
}
private static void Test(Action action, int times)
{
var stopwatch = new Stopwatch();
for (var i = 0; i < times; ++i)
{
stopwatch.Restart();
action();
Console.WriteLine(stopwatch.Elapsed.TotalSeconds);
}
}
}
The text was updated successfully, but these errors were encountered:
Version 1.0.4
JsonLD.Core.JsonLdUtils.DeepCompare(...)
has poor performance when comparing large arrays. With the provided repro (below) it takes ~4 seconds to perform a deep comparison on two objects.Repro:
The text was updated successfully, but these errors were encountered: