| 1701 | * @param {t.TestCase} _tc |
| 1702 | */ |
| 1703 | export const testLargeFragmentedDocument = _tc => { |
| 1704 | const itemsToInsert = largeDocumentSize |
| 1705 | let update = /** @type {any} */ (null) |
| 1706 | ;(() => { |
| 1707 | const doc1 = new Y.Doc() |
| 1708 | const text0 = doc1.get('txt') |
| 1709 | tryGc() |
| 1710 | t.measureTime(`time to insert ${itemsToInsert} items`, () => { |
| 1711 | doc1.transact(() => { |
| 1712 | for (let i = 0; i < itemsToInsert; i++) { |
| 1713 | text0.insert(0, '0') |
| 1714 | } |
| 1715 | }) |
| 1716 | }) |
| 1717 | tryGc() |
| 1718 | t.measureTime('time to encode document', () => { |
| 1719 | update = Y.encodeStateAsUpdateV2(doc1) |
| 1720 | }) |
| 1721 | t.describe('Document size:', update.byteLength) |
| 1722 | })() |
| 1723 | ;(() => { |
| 1724 | const doc2 = new Y.Doc() |
| 1725 | tryGc() |
| 1726 | t.measureTime(`time to apply ${itemsToInsert} updates`, () => { |
| 1727 | Y.applyUpdateV2(doc2, update) |
| 1728 | }) |
| 1729 | })() |
| 1730 | } |
| 1731 | |
| 1732 | /** |
| 1733 | * @param {t.TestCase} _tc |