Yjs is stuck with 1M data

Hi I am using yjs in table offline mode.
When changed 1M cell, Y.encodeStateVector never works.
Here are the code:

const doc1 = new Y.Doc()
const doc2 = new Y.Doc()

for (let r=0; r<1000000; r++) {
    yarray = doc1.getArray('r1c1'+r);
    yarray.push(['10']);
}
for (let r=0; r<1000000; r++) {
    yarray = doc2.getArray('r1c2'+r);
    yarray.push(['11']);
}
const stateVector1 = Y.encodeStateVector(doc1)  // stuck here
const stateVector2 = Y.encodeStateVector(doc2)
const diff1 = Y.encodeStateAsUpdate(doc1, stateVector2);
const diff2 = Y.encodeStateAsUpdate(doc2, stateVector1);
Y.applyUpdate(doc1, diff2);
Y.applyUpdate(doc2, diff1);

Please give me the best soluction

Does it work at 10k or 100k or 500k? Maybe it just takes a really long time