public override void Setup()
 {
     _atomicLong           = new AtomicLong();
     _paddedAtomicLong     = new PaddedAtomicLong();
     _stripedLongAdder     = new StripedLongAdder();
     _threadLocalLongAdder = new ThreadLocalLongAdder();
 }
Example #2
0
        public void Can_get_estimated_size()
        {
            _num.Add(32);
            var result = ThreadLocalLongAdder.GetEstimatedFootprintInBytes(_num);

            result.Should().NotBe(0);
        }
        private static void ValueAdderIncrement()
        {
            var atomicLong = new AtomicLong(0L);
            BenchmarkRunner.Run("AtomicLong.Increment", () => atomicLong.Increment());

            var threadLocalAdder = new ThreadLocalLongAdder(0L);
            BenchmarkRunner.Run("ThreadLocalLongAdder.Increment", () => threadLocalAdder.Increment());

            var strippedLongAdder = new StripedLongAdder(0L);
            BenchmarkRunner.Run("StripedLongAdder.Increment", () => strippedLongAdder.Increment());
        }
        private static void ValueAdderIncrement()
        {
            var atomicLong = new AtomicLong(0L);

            BenchmarkRunner.Run("AtomicLong.Increment", () => atomicLong.Increment());

            var threadLocalAdder = new ThreadLocalLongAdder(0L);

            BenchmarkRunner.Run("ThreadLocalLongAdder.Increment", () => threadLocalAdder.Increment());

            var strippedLongAdder = new StripedLongAdder(0L);

            BenchmarkRunner.Run("StripedLongAdder.Increment", () => strippedLongAdder.Increment());
        }
        static void Main(string[] args)
        {
            AtomicLong[] data = new AtomicLong[0];

            BenchmarkRunner.DefaultMaxThreads   = 8;
            BenchmarkRunner.DefaultTotalSeconds = 5;

            var strippedLongAdder = new StripedLongAdder(0L);
            var threadLocalAdder  = new ThreadLocalLongAdder(0L);

            //BenchmarkRunner.Run("ThreadLocalLongAdder.Increment", () => threadLocalAdder.Increment());
            //var sz = ThreadLocalLongAdder.GetEstimatedFootprintInBytes(threadLocalAdder);

            BenchmarkRunner.Run("StripedLongAdder.Increment", () => strippedLongAdder.Increment());


            //BenchmarkRunner.Run("ThreadLocalLongAdder.Increment", () => threadLocalAdder.Increment());

            //BenchmarkRunner.Run("NoOp", () => { });

            ValueAdderIncrement();
        }
        static void Main(string[] args)
        {
            AtomicLong[] data = new AtomicLong[0];

            BenchmarkRunner.DefaultMaxThreads = 8;
            BenchmarkRunner.DefaultTotalSeconds = 5;

            var strippedLongAdder = new StripedLongAdder(0L);
            var threadLocalAdder = new ThreadLocalLongAdder(0L);

            //BenchmarkRunner.Run("ThreadLocalLongAdder.Increment", () => threadLocalAdder.Increment());
            //var sz = ThreadLocalLongAdder.GetEstimatedFootprintInBytes(threadLocalAdder);

            BenchmarkRunner.Run("StripedLongAdder.Increment", () => strippedLongAdder.Increment());


            //BenchmarkRunner.Run("ThreadLocalLongAdder.Increment", () => threadLocalAdder.Increment());

            //BenchmarkRunner.Run("NoOp", () => { });

            ValueAdderIncrement();
        }
 public override void Setup()
 {
     _num = new ThreadLocalLongAdder();
 }
Example #8
0
 public void Setup()
 {
     _num = new ThreadLocalLongAdder();
 }