github.com/fibo/primes@v0.0.0-20180219095525-b987fd442b6e/benchmark_test.go (about)

     1  package primes
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  var (
     8  	from = 1000
     9  	to   = 4000
    10  )
    11  
    12  func BenchmarkUint16IsPrime(b *testing.B) {
    13  	for n := uint16(from); n < uint16(to); n++ {
    14  		Uint16IsPrime(n)
    15  	}
    16  }
    17  func BenchmarkSieve(b *testing.B) {
    18  	for m := from; m < to; m++ {
    19  		Sieve(m)
    20  	}
    21  }