Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for benchmarkCacheSetConcurrent (0.4 sec)

  1. pkg/cache/ttlCache_test.go

    func BenchmarkTTLSet(b *testing.B) {
    	c := NewTTL(5*time.Minute, 1*time.Minute)
    	benchmarkCacheSet(c, b)
    }
    
    func BenchmarkTTLSetConcurrent(b *testing.B) {
    	c := NewTTL(5*time.Minute, 1*time.Minute)
    	benchmarkCacheSetConcurrent(c, b)
    }
    
    func BenchmarkTTLGetSetConcurrent(b *testing.B) {
    	c := NewTTL(5*time.Minute, 1*time.Minute)
    	benchmarkCacheGetSetConcurrent(c, b)
    }
    
    func BenchmarkTTLSetRemove(b *testing.B) {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue May 23 17:08:31 UTC 2023
    - 2.5K bytes
    - Viewed (0)
  2. pkg/cache/cache_test.go

    			}
    			wg.Done()
    		}()
    	}
    	wg.Wait()
    }
    
    func benchmarkCacheSet(c Cache, b *testing.B) {
    	b.ResetTimer()
    	for i := 0; i < b.N; i++ {
    		c.Set("foo", "bar")
    	}
    }
    
    func benchmarkCacheSetConcurrent(c Cache, b *testing.B) {
    	wg := new(sync.WaitGroup)
    	workers := runtime.NumCPU()
    	each := b.N / workers
    	wg.Add(workers)
    
    	b.ResetTimer()
    	for i := 0; i < workers; i++ {
    		go func() {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed May 24 15:56:49 UTC 2023
    - 8.5K bytes
    - Viewed (0)
Back to top