optimize encoding of move ops
This commit is contained in:
@@ -513,8 +513,9 @@ export const testMove2 = tc => {
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo
|
||||
* @param {t.TestCase} tc
|
||||
*/
|
||||
*
|
||||
export const testMoveCircles = tc => {
|
||||
const { testConnector, array0, array1 } = init(tc, { users: 3 })
|
||||
array0.insert(0, [1, 2, 3, 4])
|
||||
@@ -528,6 +529,7 @@ export const testMoveCircles = tc => {
|
||||
t.assert(array0.length === array0.toArray().length)
|
||||
t.compareArrays(array0.toArray(), array1.toArray())
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {t.TestCase} tc
|
||||
@@ -563,12 +565,13 @@ const arrayTransactions = [
|
||||
return
|
||||
}
|
||||
const pos = prng.int32(gen, 0, yarray.length - 1)
|
||||
const len = prng.int32(gen, 1, math.min(3, yarray.length - pos))
|
||||
const len = 1 // prng.int32(gen, 1, math.min(3, yarray.length - pos))
|
||||
const _newPosAdj = prng.int32(gen, 0, yarray.length - len)
|
||||
// make sure that we don't insert in-between the moved range
|
||||
const newPos = _newPosAdj + (_newPosAdj > pos ? len : 0)
|
||||
const oldContent = yarray.toArray()
|
||||
yarray.moveRange(pos, pos + len - 1, newPos)
|
||||
// yarray.moveRange(pos, pos + len - 1, newPos)
|
||||
yarray.move(pos, newPos)
|
||||
const movedValues = oldContent.splice(pos, len)
|
||||
oldContent.splice(pos < newPos ? newPos - len : newPos, 0, ...movedValues)
|
||||
t.compareArrays(yarray.toArray(), oldContent) // we want to make sure that fastSearch markers insert at the correct position
|
||||
|
||||
Reference in New Issue
Block a user