package main

import "testing"

var s33 = []byte{32: 'b'}

var a = string(s33)

func main() {
    x := a + a // a + a does not escape
    println(x)
}

func Benchmark_e_33(b *testing.B) {
    var x string
    for i := 0; i < b.N; i++ {
        x = a + a // a + a escapes to heap
    }
    println(x)
}

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/2239f757-7750-4967-805d-7335d832fd8dn%40googlegroups.com.

Reply via email to