Revision 8f5bbad392b904d1f5b7e9f4ee262f339d999056 authored by Damian Sawicki on 13 June 2024, 08:41:41 UTC, committed by Dylan Reimerink on 15 June 2024, 08:22:04 UTC
This commit adds alternative implementations of methods of ImmSet:
 * InsertNew(xs ...T)
 * DeleteNew(xs ...T)
 * UnionNew(s2 ImmSet[T])
 * DifferenceNew(s2 ImmSet[T])
and benchmarks these implementations agains the existing ones.

Benchmarking results:
 * for Insert, the proposed method becomes faster already with the
   container of size 1000, and then it performed 10x faster for size
   10,000 and 100x faster for size 100,000;
 * for Delete, the proposed method becomes faster already with the
   container of size 1000, and then it performed ~5x faster for size
   10,000;
 * for Difference, the proposed method was already 4x faster for size
   100, and then it performed 7x faster for size 1000, 35x times faster
   for size 10,000, and 193x faster for size 100,000;
 * for Union, the proposed method performs slightly faster, but gains
   do not visibly grow with increasing size.

Theoretically, the proposed solutions have improved computational
complexity:
 * the complexity of Insert is O(len(s.xs)*len(xs)), and the complexity
   of InsertNew is O(len(s.xs)+len(xs));
 * the complexity of Delete is O(len(s.xs)*len(xs)), and the complexity
   of DeleteNew is O(len(s.xs)+len(xs));
 * the complexity of Difference is O(len(s.xs)*len(s2.xs)) because it
   uses Delete internally, and the complexity of DifferenceNew
   O(len(s.xs)+len(s2.xs));
 * the complexity of Union is harder to estimate: it involves sorting a
   slice of size n=len(s.xs)+len(s2.xs), but this slice is a
   concatenation of two sorted slices, so most likely this does not lead
   to the usual O(n*log(n)) complexity; of course, it is at least O(n);
   the complexity of UnionNew is O(n).

Signed-off-by: Damian Sawicki <dsawicki@google.com>
1 parent 5aa52b0
Raw File
vagrant-local-start.sh
#!/usr/bin/env bash

set -e

export K8S_VERSION=${K8S_VERSION:-1.30}
export K8S_NODES=${K8S_NODES:-2}

echo "destroying vms"
i=1
while vagrant destroy k8s${i}-${K8S_VERSION} --force 2>/dev/null
do
  (( i++ ))
done

if [ "$PRELOAD_VM" != "false" ]; then
    ./vagrant-local-create-box.sh
else
    # Use defaults (see ../vagrant_box_defaults.rb)
    unset SERVER_BOX
    unset SERVER_VERSION
fi

if [[ "$NFS" != "0" ]]; then
    echo "# NFS enabled. don't forget to enable these ports on your host"
    echo "# before starting the VMs in order to have nfs working"
    echo "# iptables -I INPUT -s 192.168.58.0/24 -j ACCEPT"
fi

echo "starting vms"
for i in $( seq 1 ${K8S_NODES} )
do
  echo "Starting k8s${i}-${K8S_VERSION}"
  vagrant up k8s${i}-${K8S_VERSION} --provision
done

echo "labeling nodes"
for i in $( seq 1 ${K8S_NODES} )
do
  echo "Labeling k8s${i}-${K8S_VERSION}"
  vagrant ssh k8s1-${K8S_VERSION} -- kubectl label node k8s${i} cilium.io/ci-node=k8s${i} --overwrite
done
back to top