[go-nuts] Re: It seems that go 1.22 has optimized the implementation of string to byte slicing and no longer requires memory allocation.

2023-11-27 Thread tapi...@gmail.com
See https://github.com/golang/go/issues/2205 The tip compiler is able to detect some simple string->[]byte cases in which duplication is not needed. On Monday, November 27, 2023 at 8:12:54 PM UTC+8 fliter wrote: > It seems that go 1.22 has optimized the implementation of string to byte >

[go-nuts] Re: Why does my time.Ticker work fine for 6 months then suddenly stop sending ticks?

2023-11-27 Thread 'Bryan C. Mills' via golang-nuts
Given the number of known overflows present in the `time` package (https://go.dev/issue/20678, https://go.dev/issue/56909), I wouldn't be terribly surprised to find one in Ticker as well, although 6 months seems awfully short to hit an overflow bug. Consider filing an issue at

Re: [go-nuts] Re: Why does my time.Ticker work fine for 6 months then suddenly stop sending ticks?

2023-11-27 Thread Eric Hubbard
Do all ticker stop? or just the one? I had a problem back in 1.17? where the clock that powered the tickers wasn't monotomic .. only on some systems and configurations.. -Eric http://www.google.com/profiles/eric.hubbard On Sun, Nov 26, 2023 at 11:39 PM Ari Croock wrote: > Sorry for the

Re: [go-nuts] Go/Python interop

2023-11-27 Thread 'Michael Knyszek' via golang-nuts
On Thu, Nov 23, 2023 at 11:52 AM Sebastien Binet wrote: > On Thu Nov 23, 2023 at 15:23 CET, 'Michael Knyszek' via golang-nuts wrote: > > Also, I'd like to clarify: > > > > - [David]: is it a good idea to use cgo for Go-Python interop? > > - [Michael]: no. better with pipe or RPC > > > > I'm

[go-nuts] Re: It seems that go 1.22 has optimized the implementation of string to byte slicing and no longer requires memory allocation.

2023-11-27 Thread peterGo
Assigning Benchmark results to package variables: var ( str string byt []byte ) BenchmarkString str = string(byteSli) BenchmarkUnsafe str = *(*string)(unsafe.Pointer()) BenchmarkByteStyle byt = []byte(str) BenchmarkWithUnsafe byt = *(*[]byte)(unsafe.Pointer()) $ go1.21 test

[go-nuts] Re: It seems that go 1.22 has optimized the implementation of string to byte slicing and no longer requires memory allocation.

2023-11-27 Thread Volker Dobler
Ah, and one more: On Monday, 27 November 2023 at 13:12:54 UTC+1 fliter wrote: BenchmarkTest1-83572733433.51 ns/op 192 B/op 1 allocs/op BenchmarkTest2-81471724258.157 ns/op 0 B/op 0 allocs/op BenchmarkTest3-8

[go-nuts] Re: It seems that go 1.22 has optimized the implementation of string to byte slicing and no longer requires memory allocation.

2023-11-27 Thread Volker Dobler
On Monday, 27 November 2023 at 13:12:54 UTC+1 fliter wrote: But why not optimize byte slicing to string conversion together? Try to implement that conversion and you'll see. Note that strings are immutable, even if converted from a byte slice (which are by their very nature) mutable. Good luck

[go-nuts] It seems that go 1.22 has optimized the implementation of string to byte slicing and no longer requires memory allocation.

2023-11-27 Thread fliter
It seems that go 1.22 has optimized the implementation of string to byte slicing and no longer requires memory allocation. But why not optimize byte slicing to string conversion together? ```go package main import ( "reflect" "testing" "unsafe" ) func BenchmarkString(b *testing.B) {