Re: [go-nuts] cgo: passing unsafe.Pointer of Slice without explicit pinning?

2024-07-08 Thread Ian Lance Taylor
On Mon, Jul 8, 2024 at 4:06 PM Antonio Caceres Cabrera wrote: > > Unless, the C function stores the pointer and it's kept after the call > returns, correct? That's what I mean by calling the function > keep_this_pointer in the second example. In this case, it would be necessary, > I'm assuming?

Re: [go-nuts] cgo: passing unsafe.Pointer of Slice without explicit pinning?

2024-07-08 Thread Antonio Caceres Cabrera
Unless, the C function stores the pointer and it's kept after the call returns, correct? That's what I mean by calling the function keep_this_pointer in the second example. In this case, it would be necessary, I'm assuming? Julio On Monday, July 8, 2024 at 11:56:30 PM UTC+2 Ian Lance Taylor wro

Re: [go-nuts] cgo: passing unsafe.Pointer of Slice without explicit pinning?

2024-07-08 Thread Ian Lance Taylor
On Mon, Jul 8, 2024 at 12:38 PM Antonio Caceres Cabrera wrote: > > Sorry, accidentally hit the wrong response button, so I'm posting it again: > > Thanks for the clarification, Ian. > > Is it also possible to pin memory to local go-arrays? > The docs state > >Go values created by calling new, by t

Re: [go-nuts] Benchmark "overall" operation

2024-07-08 Thread 'Robert Engels' via golang-nuts
> The usual way is to factor out any parts that can skew the results > before the benchmark loop and call b.ResetTimer() just before entering > the 'for i := 0; i < b.N; i++ {' loop. That isn’t applicable here. It is the performing of the operation that gets progressively slower. So when comparin

Re: [go-nuts] Benchmark "overall" operation

2024-07-08 Thread Jan Mercl
On Mon, Jul 8, 2024 at 10:36 PM Robert Engels wrote: > Is there anyway to do what I want? The usual way is to factor out any parts that can skew the results before the benchmark loop and call b.ResetTimer() just before entering the 'for i := 0; i < b.N; i++ {' loop. > If not, maybe a useful add

Re: [go-nuts] Benchmark "overall" operation

2024-07-08 Thread 'Robert Engels' via golang-nuts
Understood. Is there anyway to do what I want? If not, maybe a useful addition, see https://javadoc.io/doc/org.openjdk.jmh/jmh-core/latest/org/openjdk/jmh/annotations/OperationsPerInvocation.html

Re: [go-nuts] Benchmark "overall" operation

2024-07-08 Thread Jan Mercl
On Mon, Jul 8, 2024 at 10:08 PM 'Robert Engels' via golang-nuts wrote: > Given this code (which I know is not “correct”): Setting b.N in the benchmark code has no specified behavior. The actual behavior at the moment ignores such changes. The algorithm used by the testing package adjusts b.N in

Re: [go-nuts] Benchmark "overall" operation

2024-07-08 Thread robert engels
Actually, if I add b.Log("time per op",float64(b.Elapsed().Microseconds())/float64(N_ORDERS*2)) I get a different value than what benchmark reports, so I am certain setting b.N is not correct. > On Jul 8, 2024, at 3:08 PM, 'Robert Engels' via golang-nuts > wrote: > > Given this code (whi

[go-nuts] Benchmark "overall" operation

2024-07-08 Thread 'Robert Engels' via golang-nuts
Given this code (which I know is not “correct”): func BenchmarkOrders(b *testing.B) { var ob = orderBook{} var inst = Equity{} var ex = testExchangeClient{} const N_ORDERS = 100 b.ResetTimer() b.N = N_ORDERS for i:=0;ihttps://groups.google.com/d/msgid/golang-nut

Re: [go-nuts] cgo: passing unsafe.Pointer of Slice without explicit pinning?

2024-07-08 Thread Antonio Caceres Cabrera
Sorry, accidentally hit the wrong response button, so I'm posting it again: Thanks for the clarification, Ian. Is it also possible to pin memory to local go-arrays? The docs state >Go values created by calling new, by taking the address of a composite literal, or by taking the address of a local

Re: [go-nuts] Re: Go 1.21 / FIPS

2024-07-08 Thread 'Davis Goodin' via golang-nuts
Yes, these questions are specific to the Microsoft fork of Go (and to varying degrees, could apply to other FIPS-focused forks of Go). To repeat from earlier, in case it helps anyone seeing this thread later: > The GOEXPERIMENT=systemcrypto is a feature of the Microsoft fork of Go, not official