Page MenuHomePhabricator

Minify Transaction/Change serialization
Closed, ResolvedPublic

Description

Now that we have use cases for serialising transactions (auto-save, CollabPad), we should consider a more compact format, David's initial proposal is

[ { type: 'retain', length: 5 }, { type: 'replace', remove: [ 'a' ], insert: [ 'b' ] }, { type: 'retain', length: 3 } ]

->

[ 5, [ [ 'a' ], [ 'b' ] ], 3 ]

There are also attribute and annotate operations to consider. They could be left as is as they are much rarer.

Event Timeline

Esanders created this task.Feb 22 2018, 5:25 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 22 2018, 5:25 PM

Change 414026 had a related patch set uploaded (by Divec; owner: Divec):
[VisualEditor/VisualEditor@master] WIP: Minify the serialized form of Transactions

https://gerrit.wikimedia.org/r/414026

Change 414104 had a related patch set uploaded (by Esanders; owner: Esanders):
[VisualEditor/VisualEditor@master] Transactions: Only set insertedDataOffset/Length when meaningful

https://gerrit.wikimedia.org/r/414104

Change 414104 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] Transactions: Only set insertedDataOffset/Length when meaningful

https://gerrit.wikimedia.org/r/414104

Change 413904 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (d946b72)

https://gerrit.wikimedia.org/r/413904

Change 414127 had a related patch set uploaded (by Divec; owner: Divec):
[VisualEditor/VisualEditor@master] WIP: Minify the serialized form of Changes

https://gerrit.wikimedia.org/r/414127

Change 413904 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (08520dc)

https://gerrit.wikimedia.org/r/413904

dchan renamed this task from Minify transactions to Minify Transaction/Change serialization.Feb 25 2018, 8:58 PM
dchan added a comment.Feb 25 2018, 9:05 PM

For a typical authoring session, document history as a Change will contain a large proportion of transactions that are consecutive text insertions in the same place, with the same annotation as the insertion context. There may be a transaction for every keystroke (but somewhat fewer for many IMEs).

Therefore it makes sense to optimize the Change serialization to just use the inserted text string for such transactions.

Change 413904 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (e6b9330)

https://gerrit.wikimedia.org/r/413904

After the latest patches a serialized change looks like this:
{"start":1,"transactions":[{"operations":[646,["s","h"],982],"authorId":null}],"stores":[null,null,null,null,null],"selections":{}}

We could drop authorId when it's null, selections when they are empty, and stores when it is all null.

Change 414026 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] Minify the serialized form of Transactions

https://gerrit.wikimedia.org/r/414026

Change 414127 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] Minify the serialized form of Changes

https://gerrit.wikimedia.org/r/414127

Change 414601 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (35cf6d9ff)

https://gerrit.wikimedia.org/r/414601

Change 414601 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (35cf6d9ff)

https://gerrit.wikimedia.org/r/414601

Change 414653 had a related patch set uploaded (by Esanders; owner: Esanders):
[VisualEditor/VisualEditor@master] Further minification of tranasctions

https://gerrit.wikimedia.org/r/414653

Change 414653 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] Further minification of tranasctions

https://gerrit.wikimedia.org/r/414653

Change 414664 had a related patch set uploaded (by Esanders; owner: Esanders):
[VisualEditor/VisualEditor@master] ve.dm.Change: More minification

https://gerrit.wikimedia.org/r/414664

Change 414664 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] ve.dm.Change: More minification

https://gerrit.wikimedia.org/r/414664

Change 414679 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (a8da324)

https://gerrit.wikimedia.org/r/414679

Change 414679 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (a8da324)

https://gerrit.wikimedia.org/r/414679

Deskana closed this task as Resolved.Mar 8 2018, 10:33 AM
Deskana triaged this task as Medium priority.