Skip to content

Instantly share code, notes, and snippets.

@brianfoshee
Created June 24, 2016 18:35
Show Gist options
  • Select an option

  • Save brianfoshee/c6c4e22c2bbc2ccd3768653e27ea0106 to your computer and use it in GitHub Desktop.

Select an option

Save brianfoshee/c6c4e22c2bbc2ccd3768653e27ea0106 to your computer and use it in GitHub Desktop.

Revisions

  1. brianfoshee created this gist Jun 24, 2016.
    20 changes: 20 additions & 0 deletions main_test.go
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    package main

    import (
    "fmt"
    "testing"
    )

    var result string

    func BenchmarkSprintf(b *testing.B) {
    for i := 0; i < b.N; i++ {
    result = fmt.Sprintf("%s, %s", "hello", "world")
    }
    }

    func BenchmarkStringConcat(b *testing.B) {
    for i := 0; i < b.N; i++ {
    result = "hello" + ", " + "world"
    }
    }