-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #597 from streamich/simplify-deps
Simplify installed dependencies
- Loading branch information
Showing
20 changed files
with
648 additions
and
3,435 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...son-crdt/__bench__/bench.json.encoding.ts → ...t/__bench__/bench.codecs.encoding.json.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rdt/__bench__/bench.json.libs.encoding.ts → ...t/__bench__/bench.codecs.encoding.libs.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/json-crdt/__bench__/bench.sizes.ts → ...json-crdt/__bench__/bench.codecs.sizes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"scripts": { | ||
"bench:traces:crdt-libs": "npx ts-node bench.traces.crdt-libs.ts", | ||
"bench:traces:non-crdt-libs": "npx ts-node bench.traces.non-crdt-libs.ts", | ||
"bench:concurrent-traces": "npx ts-node bench.concurrent-traces.ts", | ||
"bench:codecs:encoding": "npx ts-node bench.codecs.encoding.ts", | ||
"bench:codecs:decoding": "npx ts-node bench.codecs.decoding.ts", | ||
"bench:codecs:encoding:json": "npx ts-node bench.codecs.encoding.json.ts", | ||
"bench:codecs:encoding:libs": "npx ts-node bench.codecs.encoding.libs.ts", | ||
"bench:codecs:sizes": "npx ts-node bench.codecs.sizes.ts" | ||
}, | ||
"devDependencies": { | ||
"@automerge/automerge": "2.1.13", | ||
"@collabs/collabs": "0.13.4", | ||
"diamond-types-node": "1.0.2", | ||
"loro-crdt": "^0.4.1", | ||
"rope.js": "0.1.0", | ||
"yjs": "13.6.14", | ||
"ywasm": "0.16.10" | ||
} | ||
} |
47 changes: 2 additions & 45 deletions
47
src/json-crdt/__bench__/util/editors.ts → ...json-crdt/__bench__/util/editors/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import {Timestamp} from '../../../../json-crdt-patch/clock'; | ||
import {StrNode} from '../../../nodes'; | ||
import {Model} from '../../../model'; | ||
import type {SequentialTraceEditor} from '../types'; | ||
|
||
export const editorStrNode: SequentialTraceEditor = { | ||
name: 'StrNode (json-joy)', | ||
factory: () => { | ||
let time = 0; | ||
const rga = new StrNode(new Timestamp(1, time++)); | ||
return { | ||
ins: (pos: number, insert: string) => { | ||
rga.insAt(pos, new Timestamp(1, time), insert); | ||
time += insert.length; | ||
}, | ||
del: (pos: number, len: number) => { | ||
rga.delete(rga.findInterval(pos, len)); | ||
}, | ||
get: () => rga.view(), | ||
len: () => rga.length(), | ||
chunks: () => rga.size(), | ||
}; | ||
}, | ||
}; | ||
|
||
export const editorJsonJoy: SequentialTraceEditor = { | ||
name: 'json-joy', | ||
factory: () => { | ||
const model = Model.withLogicalClock(); | ||
model.api.root(''); | ||
const str = model.api.str([]); | ||
return { | ||
ins: (pos: number, insert: string) => { | ||
str.ins(pos, insert); | ||
}, | ||
del: (pos: number, len: number) => { | ||
str.del(pos, len); | ||
}, | ||
get: () => str.view(), | ||
len: () => str.view().length, | ||
chunks: () => str.node.size(), | ||
toBlob: () => model.toBinary(), | ||
}; | ||
}, | ||
}; |
28 changes: 4 additions & 24 deletions
28
src/json-crdt/__bench__/util/execute.ts → ...json-crdt/__bench__/util/execute/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import type {SequentialTrace, SequentialTraceEditor} from '../types'; | ||
|
||
/* tslint:disable no-console */ | ||
|
||
export const runTrace = (trace: SequentialTrace, editor: SequentialTraceEditor) => { | ||
const txns = trace.txns; | ||
const txnsLength = txns.length; | ||
const editorInstance = editor.factory(); | ||
if (trace.startContent) editorInstance.ins(0, trace.startContent); | ||
for (let i = 0; i < txnsLength; i++) { | ||
const transaction = txns[i]; | ||
const patches = transaction.patches; | ||
const length = patches.length; | ||
for (let j = 0; j < length; j++) { | ||
const patch = patches[j]; | ||
const pos = patch[0]; | ||
const del = patch[1]; | ||
const insert = patch[2]; | ||
if (del) editorInstance.del(pos, del); | ||
if (insert) editorInstance.ins(pos, insert); | ||
} | ||
} | ||
return editorInstance; | ||
}; |
Oops, something went wrong.