Skip to content

Commit

Permalink
remove now unused causal queue after it was mutilated. RIP.
Browse files Browse the repository at this point in the history
  • Loading branch information
rmgk committed Dec 3, 2024
1 parent c21edef commit e3e481e
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 122 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package probench.data

import rdts.base.{Bottom, Lattice, Uid}
import rdts.datatypes.contextual.{CausalQueue, ReplicatedSet}
import rdts.datatypes.contextual.{ReplicatedSet}
import rdts.dotted.{Dotted, Obrem}
import rdts.time.Dot

Expand Down
Original file line number Diff line number Diff line change
@@ -1,55 +1,11 @@
package benchmarks.lattices

import org.openjdk.jmh.annotations.*
import rdts.base.LocalUid.asId
import rdts.datatypes.alternatives.rga.Sequence
import rdts.datatypes.alternatives.rga.Sequence.{RGA, RGAOps}
import rdts.datatypes.contextual.CausalQueue
import rdts.dotted.Dotted

import java.util.concurrent.TimeUnit

@BenchmarkMode(Array(Mode.AverageTime))
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Warmup(iterations = 3, time = 1000, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = 3, time = 1000, timeUnit = TimeUnit.MILLISECONDS)
@Fork(3)
@Threads(1)
@State(Scope.Thread)
class CausalQueueBench {

@Param(Array("100", "1000", "10000", "100000"))
var size: Int = scala.compiletime.uninitialized

@Param(Array("10000"))
var operations: Int = scala.compiletime.uninitialized

var lca: Dotted[CausalQueue[Int]] = scala.compiletime.uninitialized

@Setup
def setup(): Unit = {
lca = (1 to size).foldLeft(Dotted(CausalQueue.empty[Int])) { (q, e) => q.mod(_.enqueue(using "lca".asId)(e)) }
}

def make(base: Dotted[CausalQueue[Int]], ops: Int, prefix: String) = {
val s = ops / 2
val added = (1 to s).foldLeft(base) { (acc, v) => acc `merge` acc.mod(_.enqueue(using prefix.asId)(v)) }
(1 to s).foldLeft(added) { (acc, _) => acc `merge` acc.mod(_.dequeue()) }
}

@Benchmark
def create(): Dotted[CausalQueue[Int]] = make(lca, operations, "")

@Benchmark
def createAndMerge(): Dotted[CausalQueue[Int]] = {
val left = make(lca, operations, "left")
val right = make(lca, operations, "right")

val res = left `merge` right
res
}

}

@BenchmarkMode(Array(Mode.AverageTime))
@OutputTimeUnit(TimeUnit.MILLISECONDS)
Expand Down

This file was deleted.

13 changes: 1 addition & 12 deletions Modules/RDTs/src/test/scala/test/rdts/DataGenerator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import rdts.datatypes.*
import rdts.datatypes.GrowOnlyList.Node
import rdts.datatypes.alternatives.{MultiValueRegister, ObserveRemoveSet}
import rdts.datatypes.contextual.*
import rdts.datatypes.contextual.CausalQueue.QueueElement
import rdts.datatypes.experiments.AutomergyOpGraphLWW.OpGraph
import rdts.datatypes.experiments.{CausalDelta, CausalStore}
import rdts.dotted.*
Expand Down Expand Up @@ -83,17 +82,7 @@ object DataGenerator {
val map = Gen.listOf(pairgen).map(vs => MultiValueRegister(vs.toMap))
Arbitrary(map)

given arbCausalQueue[A: Arbitrary]: Arbitrary[CausalQueue[A]] =
Arbitrary {
Gen.listOf(
Gen.zip(uniqueDot, Arbitrary.arbitrary[A])
).map { list =>
val queue = Queue.from(list.map((dot, value) => {
QueueElement(value, dot, VectorClock(Map(dot.place -> dot.time)))
}))
CausalQueue(queue, VectorClock(queue.map(it => it.dot.place -> it.dot.time).toMap))
}
}


val genDot: Gen[Dot] =
for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.scalacheck.Prop.*
import org.scalacheck.{Arbitrary, Shrink}
import rdts.base.{Bottom, BottomOpt, Lattice, Decompose}
import rdts.datatypes.alternatives.{MultiValueRegister, ObserveRemoveSet}
import rdts.datatypes.contextual.{CausalQueue, ReplicatedList}
import rdts.datatypes.contextual.{ReplicatedList}
import rdts.datatypes.experiments.AutomergyOpGraphLWW.OpGraph
import rdts.datatypes.experiments.CausalStore
import rdts.datatypes.{GrowOnlyCounter, GrowOnlyList, GrowOnlyMap, LastWriterWins, PosNegCounter, TwoPhaseSet, contextual}
Expand Down

0 comments on commit e3e481e

Please sign in to comment.