ProductPromotion
Logo

Go.Lang

made by https://0x3d.site

GitHub - mna/gocostmodel: Benchmarks of common basic operations for the Go language.
Benchmarks of common basic operations for the Go language. - mna/gocostmodel
Visit Site

GitHub - mna/gocostmodel: Benchmarks of common basic operations for the Go language.

GitHub - mna/gocostmodel: Benchmarks of common basic operations for the Go language.

gocostmodel

This package was inspired by Brian W. Kernighan and Rob Pike's book "The Practice of Programming" (Addison-Wesley, 1999). In Chapter 7 on performance, section 7.6 (Estimation):

"It's hard to estimate ahead of time how fast a program will be [...]. It's easy, though, to create a cost model for a language or a system, which will give you at least a rough idea of how long important operations take."

This is a cost model that benchmarks common basic operations for the Go language. For it to be meaningful, it should be run on your target hardware, and the relative performance of operations is probably more important than the actual numbers. Examples of such results on a variety of hardware is available in the bench/ folder.

There may be places where compiler optimizations render some benchmarks moot. If you find any such occurrences, please open an issue or send a pull request.

The names of the *_test.go source files should give an idea of the category of operations that are benchmarked.

Example

Here is a short example of benchmark results, run on a Toshiba Chromebook 64-bit running Ubuntu (LXDE) with crouton:

BenchmarkConvIntToFloat64	1000000000	         2.16 ns/op	       0 B/op	       0 allocs/op
BenchmarkConvFloat64ToInt	2000000000	         1.26 ns/op	       0 B/op	       0 allocs/op
BenchmarkConvIntToFloat32	2000000000	         1.44 ns/op	       0 B/op	       0 allocs/op
BenchmarkConvFloat32ToInt	2000000000	         1.42 ns/op	       0 B/op	       0 allocs/op
BenchmarkConvStringToInt	30000000	        57.8 ns/op	       0 B/op	       0 allocs/op
BenchmarkConvIntToString	20000000	       108 ns/op	       1 B/op	       1 allocs/op
BenchmarkStringToByte	20000000	       110 ns/op	       8 B/op	       1 allocs/op
BenchmarkByteToString	20000000	        84.8 ns/op	       4 B/op	       1 allocs/op
BenchmarkFindSliceInt5	100000000	        13.0 ns/op	       0 B/op	       0 allocs/op
BenchmarkFindSliceStr5	20000000	        64.9 ns/op	       0 B/op	       0 allocs/op
BenchmarkFindSliceInt100	10000000	       236 ns/op	       0 B/op	       0 allocs/op
BenchmarkFindSliceStr100	 1000000	      1248 ns/op	       0 B/op	       0 allocs/op
BenchmarkFindMapInt5	100000000	        22.2 ns/op	       0 B/op	       0 allocs/op
BenchmarkFindMapStr5	20000000	        77.6 ns/op	       0 B/op	       0 allocs/op
BenchmarkFindMapInt100	30000000	        58.3 ns/op	       0 B/op	       0 allocs/op
BenchmarkFindMapStr100	20000000	        76.2 ns/op	       0 B/op	       0 allocs/op
BenchmarkFloat32Assign	2000000000	         0.99 ns/op	       0 B/op	       0 allocs/op

Installation

$ go get github.com/PuerkitoBio/gocostmodel

Running the benchmarks

$ go test -run zz -bench . [-benchmem]

Contributing

Pull requests are welcome, but the benchmarks should be for common basic operations, in the spirit of the existing benchmarks.

License

This source code is released under the BSD 3-clause license.

Articles
to learn more about the golang concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

Queries
or most google FAQ's about GoLang.

mail [email protected] to add more queries here ๐Ÿ”.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory