Skip to content
/ lotsa Public

Simple Go library for executing lots of operations spread over any number of threads

License

Notifications You must be signed in to change notification settings

tidwall/lotsa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lotsa

Lotsa is a simple Go library for executing lots of operations spread over any number of threads.

Install

go get -u github.com/tidwall/lotsa

Example

Here we load 1,000,000 operations spread over 4 threads.

var total int64
lotsa.Ops(1000000, 4,
    func(i, thread int) {
        atomic.AddInt64(&total, 1)
    },
)
println(total)

Prints 1000000

To output some benchmarking results, set the lotsa.Output prior to calling lotsa.Ops

var total int64
lotsa.Output = os.Stdout
lotsa.Ops(1000000, 4,
    func(i, thread int) {
        atomic.AddInt64(&total, 1)
    },
)

Prints:

1,000,000 ops over 4 threads in 23ms, 43,580,037/sec, 22 ns/op

Contact

Josh Baker @tidwall

License

Source code is available under the MIT License.

About

Simple Go library for executing lots of operations spread over any number of threads

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages