[go-nuts] Issue with CGO and GOGC when dealing with large buffers

2024-12-02 Thread Lealem Amedie
Hi, I’m trying to get an https server working by overwriting the accept/read/write methods in the http module. I’m using go-wolfssl for TLS. The server will accept a TLS 1.2 connection, then send some random data to the client connects, then wait for another connection. The issue that I’m se

Re: [go-nuts] Issue with CGO and GOGC when dealing with large buffers

2024-12-02 Thread Ian Lance Taylor
On Mon, Dec 2, 2024 at 9:32 AM Lealem Amedie wrote: > > I’m trying to get an https server working by overwriting the > accept/read/write methods in the http module. I’m using go-wolfssl for TLS. > > The server will accept a TLS 1.2 connection, then send some random data to > the client connects,

Re: [go-nuts] Issue with CGO and GOGC when dealing with large buffers

2024-12-02 Thread robert engels
Apologies - didn’t look closely - it doesn’t appear the buffer in the connection is used at all. I suspect though if you read the wolfssl api that the implementation may be async - meaning the data must remain referenced until it is sent. > On Dec 2, 2024, at 11:38 AM, robert engels wrote: >

Re: [go-nuts] Scalar Replacement of Aggregates (SROA)

2024-12-02 Thread Ian Lance Taylor
On Sat, Nov 30, 2024 at 7:37 PM Pepper Lebeck-Jobe wrote: > > Summary: Would we be open to adding SROA as a compiler optimization to the go > compiler? > > I recently discovered via this rathole that SROA is something that Clang does > for the programming languages which compile with it. The imp

Re: [go-nuts] Is it possible to compile a Go program without jump tables ?

2024-12-02 Thread 'Keith Randall' via golang-nuts
Ah, I see, there are still a few left in the runtime. The runtime forces optimizations on even when -N is used. So no, I don't think you can do what you want (without hacking the compiler to turn jump tables off completely.) On Monday, December 2, 2024 at 2:25:22 AM UTC-8 Karolina GORNA wrote:

Re: [go-nuts] Is it possible to compile a Go program without jump tables ?

2024-12-02 Thread 'Karolina GORNA' via golang-nuts
Hello Keith, Thank you for your curiosity. This is the procedure I follow : 1. I have written the test program main.go below in the directory switch-go 2. I use the command *GOARCH=amd64 GOOS=linux go build -gcflags=all='-N -l' . *with "go version go1.23.3 linux/amd64". 3. I ope

Re: [go-nuts] Looking for a SQLite statement parser

2024-12-02 Thread 'Jacob Shandling' via golang-nuts
Thanks for the references Julian and Jim! On Tuesday, November 26, 2024 at 8:26:07 AM UTC-8 Jim Idle wrote: I revamped the Go code generation not so long ago - performance is sound with reasonably well written grammars, and very good with good grammars. Unfortunately the sample grammars for SQL

Re: [go-nuts] Issue with CGO and GOGC when dealing with large buffers

2024-12-02 Thread Amnon
Why are you using CGO? Why not just make life easy for yourself by sticking to the http.ServeTLS built in to the Go standard library. On Monday, 2 December 2024 at 19:25:21 UTC Ian Lance Taylor wrote: > On Mon, Dec 2, 2024 at 11:16 AM Jason E. Aten wrote: > > > > ChatGPT seems to think that the

Re: [go-nuts] Issue with CGO and GOGC when dealing with large buffers

2024-12-02 Thread robert engels
You are using the same buffer for reading and writing - I suspect that is your problem... > On Dec 2, 2024, at 11:00 AM, Lealem Amedie wrote: > > Hi, > > I’m trying to get an https server working by overwriting the > accept/read/write methods in the http module. I’m using go-wolfssl for TLS.

Re: [go-nuts] Issue with CGO and GOGC when dealing with large buffers

2024-12-02 Thread Jason E. Aten
ChatGPT seems to think that the go-wolfssl library is not following proper CGO rules in many places. The transcript below is long. I post it nonetheless, in case such analysis is new for readers. I would suggest that you (everyone) can and should be doing this kind of "code review by LLM" yo

Re: [go-nuts] Issue with CGO and GOGC when dealing with large buffers

2024-12-02 Thread Ian Lance Taylor
On Mon, Dec 2, 2024 at 11:16 AM Jason E. Aten wrote: > > ChatGPT seems to think that the go-wolfssl library is not following proper > CGO rules in > many places. The transcript below is long. I post it nonetheless, in case > such > analysis is new for readers. I would suggest that you (everyone

Re: [go-nuts] Issue with CGO and GOGC when dealing with large buffers

2024-12-02 Thread Jason E. Aten
Sorry. I've deleted those unhelpful suggestions. -- 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

Re: [go-nuts] Issue with CGO and GOGC when dealing with large buffers

2024-12-02 Thread robert engels
I don’t think either suggestion was unhelpful. My first thought was the library was broken as well, as Ian provided some evidence of. And not using CGO should almost always be your first choice when there are Go only solutions available. Too many things to get right in a highly concurrent system

Re: [go-nuts] Issue with CGO and GOGC when dealing with large buffers

2024-12-02 Thread robert engels
You might want to run under asan, msan, and tsan - as maybe the library is corrupting it’s own data structures? Just an idea. > On Dec 2, 2024, at 4:52 PM, robert engels wrote: > > I don’t think either suggestion was unhelpful. My first thought was the > library was broken as well, as Ian prov

[go-nuts] Where should I define the errors in a Go project?

2024-12-02 Thread JUAN DIEGO LATORRE RAMIREZ
I am trying to standardize an architecture for my Go projects, so I have a file structure like this: ├── go.mod ├── go.sum ├── internal │ ├── domain │ │ ├── models │ │ │ └── user.go │ │ └── services │ │ └── user.go │ └── repositories