HTML Preparation code:
AخA
 
1
<script src='https://cdnjs.cloudflare.com/ajax/libs/immutable/3.8.1/immutable.min.js'></script>
2
<script src='https://s3.amazonaws.com/www.deanius.com/javascripts/mongodb-diff.umd.js'></script>
3
<script src='https://s3.amazonaws.com/www.deanius.com/javascripts/immutablediff.umd.js'></script>
4
<script src='https://cdnjs.cloudflare.com/ajax/libs/deep-diff/0.3.3/deep-diff.min.js'></script>
Script Preparation code:
x
 
var beforeText = {"_id":"DZqGmqL6T9TBN6KXp","title":"Foofoo","createdAt":1475201145611,"createdBy":"Pe92xcgNnbi3yAebn","updatedBy":"Pe92xcgNnbi3yAebn","updatedAt":1475201156823,"artifactType":"creation","type":"canvas","status":"active","pages":[{"title":"Page 1","_id":"NMGnvMihjvB4XxZa7","createdAt":1475201145612,"items":{"_order":["dsbDxZQr7zMZ9JKYF"],"dsbDxZQr7zMZ9JKYF":{"_id":"dsbDxZQr7zMZ9JKYF","version":"1.0.0","style":{"text_align":"center","padding_left":12,"padding_right":12,"padding_top":28,"padding_bottom":28,"opacity":1},"settings":{"subtitle":false},"type":"headline","text":{"en":{"text":"<p>The word</p>"}}}}}],"settings":{"viewType":"free-form"}};
var afterText = {"_id":"DZqGmqL6T9TBN6KXp","title":"Foofoo","createdAt":1475201145611,"createdBy":"Pe92xcgNnbi3yAebn","updatedBy":"Pe92xcgNnbi3yAebn","updatedAt":1475201226516,"artifactType":"creation","type":"canvas","status":"active","pages":[{"title":"Page 1","_id":"NMGnvMihjvB4XxZa7","createdAt":1475201145612,"items":{"_order":["dsbDxZQr7zMZ9JKYF","J7y7NPf2WWema4sjy"],"dsbDxZQr7zMZ9JKYF":{"_id":"dsbDxZQr7zMZ9JKYF","version":"1.0.0","style":{"text_align":"center","padding_left":12,"padding_right":12,"padding_top":28,"padding_bottom":28,"opacity":1},"settings":{"subtitle":false},"type":"headline","text":{"en":{"text":"<p>The word</p>"}}},"J7y7NPf2WWema4sjy":{"_id":"J7y7NPf2WWema4sjy","version":"1.0.0","style":{"padding_left":12,"padding_right":12,"padding_top":18,"padding_bottom":18},"settings":{"title":false,"description":false,"caption":false},"type":"text","text":{"en":{"text":"<p>My first text</p>"}}}}}],"settings":{"viewType":"free-form"}};
var newEl = {"_id":"J7y7NPf2WWema4sjy","version":"1.0.0","style":{"padding_left":12,"padding_right":12,"padding_top":18,"padding_bottom":18},"settings":{"title":false,"description":false,"caption":false},"type":"text","text":{"en":{"text":"<p>My first text</p>"}}}
var beforeTextI = Immutable.fromJS(beforeText);
var afterTextI = beforeTextI.setIn(['items', 'J7y7NPf2WWema4sjy'], newEl)
Tests:
  • DeepDiff (beforeText, afterText)

     
    DeepDiff(beforeText, afterText)
  • MongoDBDiff.diff(beforeText, afterText)

     
    MongoDBDiff.diff(beforeText, afterText)
  • MongoDBDiff.diff *.toJS()

     
    MongoDBDiff.diff(beforeTextI.toJS(), afterTextI.toJS())
  • ImmutableDiff two mostly shared objects

     
    idiff(beforeTextI, afterTextI)
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    DeepDiff (beforeText, afterText)
    MongoDBDiff.diff(beforeText, afterText)
    MongoDBDiff.diff *.toJS()
    ImmutableDiff two mostly shared objects

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 5 years ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36
Chrome 79 on Linux
View result in a separate tab
Test name Executions per second
DeepDiff (beforeText, afterText) 38981.0 Ops/sec
MongoDBDiff.diff(beforeText, afterText) 35049.1 Ops/sec
MongoDBDiff.diff *.toJS() 20924.8 Ops/sec
ImmutableDiff two mostly shared objects 109612.8 Ops/sec