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
Today, when reserving the objectEqual function in this library while evaluating deep.equal call stacks in a chai test harness, I observed that when comparing objectEqual() from the default branch in extensiveDeepEqualByType) it sorts the keys.
Is it not more performant for large objects to just iterate over unsorted properties with something like hasOwnProperty on the rightHandProperty properties? If so, I can make a PR.
The text was updated successfully, but these errors were encountered:
Is it not more performant for large objects to just iterate over unsorted properties
Great question! I don't know the answer to that. We have a benchmark suite already set up so you could have a go at running the benchmarks, modifying the code and rerunning the benchmarks. I'd be interested to see what happens! And we'd welcome a PR to make things faster!
Ok let me review the documentation about running the benchmark suite. I was talking with that friend when stepping through the functions called via chai and I presume it does not make a large difference for small objects, but large object comparison could be slow if you sort the keys of both objects.
I will work on a test case, then post back with samples, the benchmark difference, and of course the code change required.
Today, when reserving the
objectEqual
function in this library while evaluatingdeep.equal
call stacks in a chai test harness, I observed that when comparingobjectEqual()
from thedefault
branch inextensiveDeepEqualByType)
it sorts the keys.deep-eql/index.js
Line 418 in 04d6da6
deep-eql/index.js
Line 419 in 04d6da6
Is it not more performant for large objects to just iterate over unsorted properties with something like
hasOwnProperty
on therightHandProperty
properties? If so, I can make a PR.The text was updated successfully, but these errors were encountered: