Re: [go-nuts] Memory share between 2 executables

2025-07-26 Thread Jason E. Aten
I'm assuming that Léa is using Hashicorp's gRPC plugin approach for Go (https://github.com/hashicorp/go-plugin) or similar, and that executable really does mean a separate program in a separate process. As Robert points out, it is possible to share memory if you really want to between processes.

[go-nuts] nice ideas for optimization, an offshoot of Golang, and a pony

2025-07-26 Thread Jason E. Aten
1. A great talk on performance measurement (2019): The Coz profiler by Emery Berger of Hoard allocator fame ( https://github.com/emeryberger/Hoard ) https://www.youtube.com/watch?v=r-TLSBdHe1A Emery points out the the address space layout of your code can cause 40% variation in performance.

[go-nuts] Re: MCP <> DAP server written in Go

2025-07-19 Thread Jason E. Aten
Hi Michael, You can readily lookup these terms on the web. Derek gave you the expansion of both acronyms. Jason On Saturday, July 19, 2025 at 12:16:24 PM UTC+2 Michael Oguidan wrote: > Hi Derek Parker, please what are MCP and DAP > > On Thursday, July 17, 2025 at 12:14:38 AM UTC Derek Parker

[go-nuts] Re: crypto/tls: Misleading "remote error: tls: certificate required" error when client cert CA not in server's accepted CAs list

2025-07-19 Thread Jason E. Aten
Hi Michael, See the 9th bullet point under https://en.wikipedia.org/wiki/Transport_Layer_Security#Client-authenticated_TLS_handshake and https://en.wikipedia.org/wiki/Mutual_authentication In short, client certs are just like server certs. Any cert is a public key signed by a (Certificate Au

[go-nuts] Re: how to update race detector to latest tsan?

2025-07-07 Thread Jason E. Aten
I filed https://github.com/golang/go/issues/74487 to track this. On Monday, July 7, 2025 at 4:14:07 PM UTC+2 Jason E. Aten wrote: > Ugh. I don't know why groups removed all the newlines in that paste. Here > it is again with manually inserted newlines: > > jaten@rog /usr $ c

[go-nuts] Re: how to update race detector to latest tsan?

2025-07-07 Thread Jason E. Aten
1 data race(s) jaten@rog /usr/local/dev-go/tmp/llvm-project-46e3ec0244c4d75a57cd635a28a9d5cbaee67c3d/compiler-rt/lib/tsan/go $ On Monday, July 7, 2025 at 4:09:45 PM UTC+2 Jason E. Aten wrote: > Ah. I see that racebuild is just a thin wrapper around a shell script. Ok. > So I tried to > execute that shel

[go-nuts] Re: how to update race detector to latest tsan?

2025-07-07 Thread Jason E. Aten
() :0 +0x0 Goroutine 2 (running) created at: () :0 +0x0 == Found 1 data race(s) jaten@rog /usr/local/dev-go/tmp/llvm-project-46e3ec0244c4d75a57cd635a28a9d5cbaee67c3d/compiler-rt/lib/tsan/go $ On Monday, July 7, 2025 at 3:22:43 PM UTC+2 Jason E. Aten wrote: > I'm trying to char

[go-nuts] how to update race detector to latest tsan?

2025-07-07 Thread Jason E. Aten
I'm trying to characterize the race-detector/tsan corruption bugs found in https://github.com/golang/go/issues/74019, on the latest pre-release of go1.25 (at b062eb46e8e76ad39029d0c1b13e4eb81c692c20 which is tagged as "*release-branch.go1.25").* I tried to follow the Go src/runtime/race/README in

[go-nuts] Re: fmap: a faster map

2025-06-27 Thread Jason E. Aten
Hi Christoph, You might have seen my deterministic map findings that showed that if your access pattern is repeated full range scans, then caching the key/value pairs in a slice soundly trounces the built in map soundly due to better L1 utilization. https://groups.google.com/g/golang-nuts/c/Me

Re: [go-nuts] Future hardware and Zig (cool computer science - tangential to Go)

2025-06-26 Thread Jason E. Aten
x27;zig ar' go build` > Not a lot of nice options otherwise for MacOS. > > On Thu, Jun 26, 2025, 13:23 Jason E. Aten wrote: > >> I've been thinking maybe I should set up a blog to talk about non-Go >> computer science... so maybe I'll get to that...it seems li

[go-nuts] Future hardware and Zig (cool computer science - tangential to Go)

2025-06-26 Thread Jason E. Aten
I've been thinking maybe I should set up a blog to talk about non-Go computer science... so maybe I'll get to that...it seems like a big undertaking. In the meantime, here are some very cool topics I have come across recently that are (tangentially) related to Golang: 1. Sophie Wilson on the f

Re: [go-nuts] Re: Use a hash/maphash uint64 as map key

2025-06-26 Thread Jason E. Aten
On Thursday, June 26, 2025 at 9:22:14 AM UTC+2 Robert Engels wrote: “ negligible chance of collision” is not scientific. It depends on the use case whether or not it is negligible. On Jun 26, 2025, at 2:14 AM, Jason E. Aten wrote: negligible chance of collision Thanks Robert. You're

[go-nuts] Re: Use a hash/maphash uint64 as map key

2025-06-26 Thread Jason E. Aten
On Wednesday, June 25, 2025 at 5:25:51 PM UTC+2 Pierre Durand wrote: Is it safe to use the result of a hash/maphash (uint64) as a map key. Is there a risk of collision ? (different inputs generate the same hash) Thank you Hi Pierre, If it helps, I usually just cryptographically hash the key (

[go-nuts] Re: Save and Restore State of 3rd party data

2025-06-22 Thread Jason E. Aten
hms that you mention. > > Thank you! > > lbe > > On Sunday, June 22, 2025 at 11:02:25 AM UTC-5 Jason E. Aten wrote: > >> Hi Ibe, >> >> gob is unsupported and not optimal in many ways. >> >> I would invite you to try my serialization package. >> h

[go-nuts] Re: Save and Restore State of 3rd party data

2025-06-22 Thread Jason E. Aten
Hi Ibe, gob is unsupported and not optimal in many ways. I would invite you to try my serialization package. https://github.com/glycerine/greenpack You can serialize unexported fields if you wish to with the -unexported flag, though I generally don't. For the slow down, you might look at using

[go-nuts] injecting network faults under synctest

2025-06-14 Thread Jason E. Aten
Go 1.25rc1 includes the new exciting and no-longer-experimental testing/synctest package. To make use of synctest in your tests of network code, you'll need to mock, or simulate the network. To help with this, I wrote gosimnet. https://github.com/glycerine/gosimnet Gosimnet not only mocks (si

[go-nuts] Re: About "godebug (x509negativeserial=1)"

2025-06-11 Thread Jason E. Aten
-that you might better wish to avoid. On Thursday, June 12, 2025 at 4:42:01 AM UTC+1 Jason E. Aten wrote: > Maybe the TLS clients are providing certs too, and those are old? > > On Thursday, June 12, 2025 at 4:33:55 AM UTC+1 Jason E. Aten wrote: > >> https://pkg.go.dev/crypto/x50

[go-nuts] Re: About "godebug (x509negativeserial=1)"

2025-06-11 Thread Jason E. Aten
https://pkg.go.dev/crypto/x509#ParseCertificate https://stackoverflow.com/questions/79061981/failed-to-parse-certificate-from-server-x509-negative-serial-number https://cs.opensource.google/go/go/+/refs/tags/go1.24.4:src/crypto/x509/parser.go;l=926 says serial := new(big.Int) if !tbs.ReadASN1In

[go-nuts] Re: About "godebug (x509negativeserial=1)"

2025-06-11 Thread Jason E. Aten
Maybe the TLS clients are providing certs too, and those are old? On Thursday, June 12, 2025 at 4:33:55 AM UTC+1 Jason E. Aten wrote: > https://pkg.go.dev/crypto/x509#ParseCertificate > > > https://stackoverflow.com/questions/79061981/failed-to-parse-certificate-from-server-x509-neg

[go-nuts] have you got ze time? a library for timestamps, dates, and calendars

2025-06-10 Thread Jason E. Aten
You really want to use a time library built by physicists, which is why I've always appreciated the Go standard "time" library by Russ Cox and Rob Pike. In contrast, timestamp support in other languages, like R, is based on the C standard lib, which can be painful. I've actually built R librari

[go-nuts] Re: rr's chaos mode for hard to reproduce bugs

2025-06-06 Thread Jason E. Aten
k you, > Thank you all. > > Le jeudi 5 juin 2025 à 22:28:07 UTC+2, Jason E. Aten a écrit : > >> Hmm. Maybe rr found a bug in runtime GC code(?)... or >> maybe it will be hard to use rr on Go. Let's see what the runtime folks >> say >> on this issue: >

[go-nuts] Re: rr's chaos mode for hard to reproduce bugs

2025-06-05 Thread Jason E. Aten
Hmm. Maybe rr found a bug in runtime GC code(?)... or maybe it will be hard to use rr on Go. Let's see what the runtime folks say on this issue: https://github.com/golang/go/issues/74019 On Wednesday, June 4, 2025 at 12:18:45 PM UTC+1 Jason E. Aten wrote: > This is a fascinating app

[go-nuts] rr's chaos mode for hard to reproduce bugs

2025-06-04 Thread Jason E. Aten
This is a fascinating approach to finding hard to reproduce event-interleaving related bugs. I'm particularly interested in this approach because rr record and replay plus chaos mode is directly applicable to Go programs -- whereas deterministic simulation testing (DST) is next to impossible in

Re: [go-nuts] S2 Compression Index

2025-06-02 Thread Jason E. Aten
, it may be worth it. On Tuesday, June 3, 2025 at 12:12:30 AM UTC+1 Jason E. Aten wrote: > Ah, I believe Klaus Post wrote S2 as a faster version of Snappy. I believe > it is his own algorithm. He > aimed for very fast execution on non-compressible data, and for snappy > compatib

Re: [go-nuts] S2 Compression Index

2025-06-02 Thread Jason E. Aten
Ah, I believe Klaus Post wrote S2 as a faster version of Snappy. I believe it is his own algorithm. He aimed for very fast execution on non-compressible data, and for snappy compatibility in one direction. https://pkg.go.dev/github.com/klauspost/compress/s2 "S2 is designed to have high throughp

[go-nuts] statistical association testing/Fisher Exact and Chi-squared tests

2025-05-28 Thread Jason E. Aten
I open sourced a new Fisher-Exact and Pearson Chi-squared test package, with zero other dependencies, here: https://github.com/glycerine/fisherexact It includes a user friendly introduction to what these statistics are for. Enjoy. Jason -- You received this message because you are subscribed

[go-nuts] Re: The motivation for the use of length in copy function instead of the capacity

2025-05-28 Thread Jason E. Aten
Hi Сергей It sounds like you are coming from a C/low level optimization point of view. Which is great. But there are things about Go that might you surprise you then. For example, the backing array for the slice is always fully zero-value initialized anyway. So changing its length within its c

Re: [go-nuts] Guaranteeing deterministic execution of Golang code

2025-05-26 Thread Jason E. Aten
Interesting observation, thanks Robert! I'll have to think about that more. Off the cuff, I don't think they mutually exclusive. Randomness might benefit liveness properties too/not just a safety ones. On Monday, May 26, 2025 at 12:58:17 PM UTC+1 Robert Engels wrote: I am pretty sure that isn

Re: [go-nuts] Guaranteeing deterministic execution of Golang code

2025-05-26 Thread Jason E. Aten
Since I've been researching reproducible simulation testing recently, and thinking about how to maximize determinism, I was reading this two year old thread. I had a "lightbulb over the head" moment. I realized _why_ Go's select statement, from CSP, from Dijkstra's guarded commands, is specifie

[go-nuts] dmap, deterministic map iterator order for DST

2025-05-24 Thread Jason E. Aten
I needed deterministic map iteration order for my deterministic simulation testing (using the new testing/synctest package -- experimental in go1.24, but proposal approved to move forward, yay!) so I wrote a "dmap" which provides repeatably ordered full range scan for keys that can be turned into

Re: [go-nuts] great talk on database/memory trends, DST, and the weaknesses of Raft

2025-05-24 Thread Jason E. Aten
te memory will be slower than local memory - as the remote > memory still goes through the bus plus the overhead. > > On May 24, 2025, at 8:01 PM, Jason E. Aten wrote: > >  > He does claim that bandwidth for peer to peer, saying > > 800 Gbps on a single link > and >

Re: [go-nuts] great talk on database/memory trends, DST, and the weaknesses of Raft

2025-05-24 Thread Jason E. Aten
. The 800GB/sec is the throughput the fabric, not a peer to peer rate. So yes, the network can support multiple clients at a TOTAL rate greater than the speed of an individual machine - eventually the data goes through the memory bus of a machine. On May 24, 2025, at 7:40 PM, Jason E.

Re: [go-nuts] great talk on database/memory trends, DST, and the weaknesses of Raft

2025-05-24 Thread Jason E. Aten
gt; You could theoretically achieve “ultra speeds” with multicasting, on a > super fast ethernet bus - but the source is still probably limited to > memory speeds. > > So the abstract you provided doesn’t jive with me. > > On May 24, 2025, at 7:06 PM, Jason E. Aten wrote: > &

[go-nuts] great talk on database/memory trends, DST, and the weaknesses of Raft

2025-05-24 Thread Jason E. Aten
This is an amazing talk from last year 2024 March 22 Qcon from the TigerBeetle CEO, Joran Greef. Zig has lessons for Go. "Redesigning OLTP for a New Order of Magnitude" https://www.infoq.com/presentations/redesign-oltp/ Early on the talks covers that latest trends in memory vs network vs disk, (h

Re: [go-nuts] wanix = webassembly + unix -> plan9 in the browser

2025-05-23 Thread Jason E. Aten
82 > progrium wrote you can reply. short answer is soon go will work and there is a way to give it full internet/network access via a websocket gateway (but is only setup in the alpine environment in that branch) On Friday, May 23, 2025 at 8:41:28 AM UTC+1 Nagaev Boris wrote: > On Thu, May

[go-nuts] wanix = webassembly + unix -> plan9 in the browser

2025-05-22 Thread Jason E. Aten
Despite the hilarious name, this is the most awesome display of developer virtuosity-- Wanix is a plan9-sh, fully local, web development environment. It runs a plan9 like shell in the browser (using a service worker) that can JIT your code to wasm or x86, using an embedded Go compiler that was co

Re: [go-nuts] Execute so exported function in Go

2025-05-15 Thread Jason E. Aten
wow. that .go got mangled by copy and paste. 2nd attempt: package main /* #cgo LDFLAGS: -ldl #include #include #include // Define the function type that matches our C function typedef int (*multiply_func)(int, int); // Helper function to load and call the multiply function int call_multiply(

Re: [go-nuts] Execute so exported function in Go

2025-05-15 Thread Jason E. Aten
Below is a working example in C. Once you have that going, then add the CGO layer on top to call from Go. Note I seem to recall you might have to mark your C function as //extern ...maybe, if in a separate C file and not inline in the .go file... read the CGO docs in full for details. $ cat libe

[go-nuts] I saw the news today, oh boy

2025-05-14 Thread Jason E. Aten
...that Ian Lance Taylor is departing Google and taking a break from Go. Ian has been an inspiration and a leader by example of how to foster and create a vibrant technical community. To me, and I suspect to many, he has been the face of Go for over a decade. He sets the highest bar for professio

[go-nuts] deterministic runtime with pseudo-random-number generator?

2025-05-13 Thread Jason E. Aten
I'd like to run variations of my Raft test code on a fully deterministic runtime (meaning only one thread, all randomness from a pseudo RNG controlled with a repeatable seed). I was looking at the standard (big) Go runtime, and I don't see where there are any options to control the random number

Re: [go-nuts] Adding methods to non local types that use more state than available in the non local type

2025-05-12 Thread Jason E. Aten
ntion is indeed a problem I can mitigate by sharding the map > 4. If contention continues to be a problem perhaps weak pointers with this > recipe https://github.com/golang/go/issues/67552#issuecomment-2195479919 may > help. > > It won't be pretty but hey - help beggars can

Re: [go-nuts] Adding methods to non local types that use more state than available in the non local type

2025-05-12 Thread Jason E. Aten
Forgive me if this off base, as I'm still a little fuzzy on the exact constraints of you problem... but, as stated, if you want to associate additional optional behavior and state with any given response that is constrained to the generated, just use the responses's pointer (to its struct) (if lo

Re: [go-nuts] Adding methods to non local types that use more state than available in the non local type

2025-05-11 Thread Jason E. Aten
I think you have just misunderstood how to embed types in Go, because you say *> // Declare a new type that embeds the generated.Response> type EnrichedResponse generated.Response* and this is not type embedding, it is just a type definition, giving a new name and new type for the existing st

[go-nuts] Re: net/icmp: Echo.ID and Echo.Seq are defined as int, but Marshal converts them to uint16

2025-05-11 Thread Jason E. Aten
Hi Yuen Sun, Your question is a fine one, but better directed to the Go development team than to general users of Go. If its going to be fixed, it will need issue anyway, so I suggest simply filing an issue and/or asking on golang-dev. https://github.com/golang/go/issues https://groups.google.com

Re: [go-nuts] single instance of package/mutex in a build?

2025-05-11 Thread Jason E. Aten
Thanks for the reply, Robert. I had thought, mistakenly that v1.6 and v1.7, of v0.8 and v1.0 might collide, and I was concerned about having multiple instances of a what should be a global mutex. But it turns out, when I tested this, and as Axel kindly pointed out, the module system will alway

Re: [go-nuts] single instance of package/mutex in a build?

2025-05-11 Thread Jason E. Aten
ur case would break, that would break as > well. > > [1] Some may argue that this is not "the same package", as different major > versions can be considered different modules and because Semantic Import > Versioning is intentionally part of the module design. However, I thin

[go-nuts] single instance of package/mutex in a build?

2025-05-10 Thread Jason E. Aten
Is there a way to insure I've only got one version of a package in a build? I need to make sure a single mutex is used by all goroutines. Detailed back story is here: https://github.com/golang/go/issues/73665 -- You received this message because you are subscribed to the Google Groups "golang-

[go-nuts] Re: Goroutines and channels optimization

2025-05-10 Thread Jason E. Aten
Friday, May 9, 2025 at 9:27:11 PM UTC+1 Jason E. Aten wrote: > There's not enough detail here to be more prescriptive than "use the > profiler". You can of course insert calls to t := time.Now() at lots of > places, compute time.Since(t) after an aggregate operation, and coll

[go-nuts] Re: boosting synctest & gosimnet, a channels-only network-mock

2025-05-09 Thread Jason E. Aten
9, 2025 at 12:16:59 PM UTC+1 Jason E. Aten wrote: > Somehow I missed it when it was first announced, so only > recently did I discover the exciting testing/synctest experiment > available in go1.24. > > If you are a fan of repeatable, deterministic tests > for tricky concurrent

[go-nuts] Re: Goroutines and channels optimization

2025-05-09 Thread Jason E. Aten
There's not enough detail here to be more prescriptive than "use the profiler". You can of course insert calls to t := time.Now() at lots of places, compute time.Since(t) after an aggregate operation, and collect statistics on the time each operation takes -- a kind of poor-person's manual prof

[go-nuts] boosting synctest & gosimnet, a channels-only network-mock

2025-05-09 Thread Jason E. Aten
Somehow I missed it when it was first announced, so only recently did I discover the exciting testing/synctest experiment available in go1.24. If you are a fan of repeatable, deterministic tests for tricky concurrent code... you should really check out synctest. My RPC package tests go 10x fast

Re: [go-nuts] Re: A CLI that generates tests using AI

2025-05-04 Thread Jason E. Aten
I like command line tools, but the docs here are a little too Spartan/sparse. For example, how does one describe to the AI what kind of test you want it to write? Does it guess? That would be risky, or asking a bit much. On Sunday, May 4, 2025 at 8:59:48 AM UTC+1 Cheikh Seck wrote: > It's a st

[go-nuts] Re: Creating os.Process from existing Handle

2025-05-03 Thread Jason E. Aten
maybe see if the https://github.com/glycerine/bark approach will work for you. On Wednesday, April 30, 2025 at 6:59:20 PM UTC+1 David Bernecker wrote: > The tool I am working on needs to start a privileged process and wait for > the completion of the new process on both Linux and Windows. To ke

[go-nuts] Paxos, Raft and an easy start to model checking with Spin

2025-04-12 Thread Jason E. Aten
I've been reading up on replication algorithms. If you are interested in playing with model checking or understanding Paxos or Raft (really, it is not that difficult), I put a short getting started guide, along with a Paxos promela/Spin model that you can check in 2 seconds, here: https://github.c

[go-nuts] Re: Returning success from a canceled goroutine in an gRPC server stub

2025-04-05 Thread Jason E. Aten
I don't know gRPC well enough to really answer your query, but I can comment on the design... that I would be very cautious and wary about removing back-pressure for a system, like you are thinking of doing. Because e.g. without back-pressure, I would expect the system to fill up the local disk

[go-nuts] appropriate way to call fcntl(2) from Go on darwin?

2025-04-05 Thread Jason E. Aten
I'm porting some C code that does manual filesystem "extent" file space management from Linux to Darwin (and into Go). The Linux fallocate() call and its FALLOC_FL_INSERT_RANGE operation are not directly available on Darwin, but suggestions from StackOverflow indicate that fcntl(2) with F_PREA

[go-nuts] Re: Delve v1.24.1 released

2025-04-05 Thread Jason E. Aten
Thank you for Delve and all the hard work that continues to go into it. While I mostly do print debugging, there are times when I find using hardware watchpoints to see when a specific memory location is read/written simply invaluable. On Thursday, March 6, 2025 at 6:01:05 PM UTC Derek Parker w

Re: [go-nuts] appropriate way to call fcntl(2) from Go on darwin?

2025-04-05 Thread Jason E. Aten
I filed https://github.com/golang/go/issues/72923 just in case, since its easier to do this while everything is top of desk. I appreciate all the help. Thanks again. On Tuesday, March 18, 2025 at 3:27:42 PM UTC Jason E. Aten wrote: > Thank you so much, Ian. > > On Tuesday, March 18,

[go-nuts] Re: x/text/unicode/bidi - how to draw attention to two bugs?

2025-04-04 Thread Jason E. Aten
Hi Patrick, Not to discourage you from pressing for fixes, but 9 times out of 10 I have to just end up forking open source projects to fix bugs and then just use my own fork. This is the fast path. Perhaps you've already intuited this. Just to let you know you aren't alone in the experience. O

[go-nuts] Re: ANN: jcp does rsync, but 3x faster

2025-03-29 Thread Jason E. Aten
stion as whether jcp can efficiently update incremental > backups from primary to secondary local storage, e.g. daily backup of a > home dir to an attached memory stick or an alternate folder on the same > filesystem. > > On Friday, March 28, 2025 at 3:55:30 PM UTC-7 Jason E. Aten wrote:

[go-nuts] Re: ANN: jcp does rsync, but 3x faster

2025-03-28 Thread Jason E. Aten
d back to the same host's local storage -- this is going to be wildly less efficient than using tar or cp to do local disk copies. On Friday, March 28, 2025 at 6:24:30 PM UTC G wrote: is it able to use a local storage as backup? Thanks On Thursday, March 20, 2025 at 10:04:45 PM UTC-7 Ja

[go-nuts] Re: parse output of exec.Command

2025-03-27 Thread Jason E. Aten
Hi Natxo, You can also use "crypto/x509" x509.ParseCertificate() after pem.Decode() from "encoding/pem", if you are only loading certificates and want a more rigorous way to determine the certificate's contents. Example here: https://github.com/glycerine/rpc25519/blob/master/selfcert/step5_view

[go-nuts] ANN: jcp does rsync, but 3x faster

2025-03-26 Thread Jason E. Aten
I've open sourced jcp, my rsync-like file transfer library and CLI. By using Go's fabulous multicore support, jcp can do diff-only filesystem syncs up to 3x faster than rsync (which is a single threaded C program). It uses a parallelized version of the FastCDC algorithm with a Gear table to ship

Re: [go-nuts] Experience Report: Using Coroutines for Parsing

2025-03-24 Thread Jason E. Aten
I implemented this iter.Pull strategy for keeping parser state, instead of using a background goroutine (as I did for years) in my pure Go lisp, zygomys, and the resulting code is much easier to read and follow, and about 12% faster on Linux (although 0.3% slower on Darwin). Details and specif

[go-nuts] Re: Go Raw UDP Socket on Windows — "An invalid argument was supplied" Error

2025-03-22 Thread Jason E. Aten
(I think raw sockets may require admin privs; at least Claude suggested this https://go.dev/play/p/ZdqkgiGyr-v ) On Saturday, March 22, 2025 at 2:48:01 PM UTC Jason E. Aten wrote: > The Claude 3 Sonnet LLM gives this, which runs fine (I tested) on Windoze > and the Go playground: >

[go-nuts] Re: Go Raw UDP Socket on Windows — "An invalid argument was supplied" Error

2025-03-22 Thread Jason E. Aten
The Claude 3 Sonnet LLM gives this, which runs fine (I tested) on Windoze and the Go playground: https://go.dev/play/p/YjNQ5Ru_eLq On Saturday, March 22, 2025 at 10:12:19 AM UTC Kanak Bhatia wrote: > Hey everyone, > > I’m trying to learn how to build a raw UDP socket in Go (on Windows) using >

Re: [go-nuts] Potential language feature for testing value membership in if statements?

2025-03-19 Thread Jason E. Aten
Hi Mike, I don't know what quirk of human nature is that causes so many to want to change a language to fit their whims, when that language has as a principal virtue that it wants to be super readable and almost never change (visit C++ for a strong argument as to Go's posture is so beneficial;

[go-nuts] on coroutines

2025-03-19 Thread Jason E. Aten
If you haven't seen it, this is a great read on coroutines (uses, advantages, disadvantages, design of systems, integration with threading systems, reification, real-world examples in network protocols like SSH ...) by the brilliant Simon Tatham of PuTTY fame. https://www.chiark.greenend.org.uk/~s

Re: [go-nuts] sharded rw mutex approaches?

2025-03-15 Thread Jason E. Aten
riday, March 14, 2025 at 4:29:46 AM UTC Robert Engels wrote: > I think it is easier to just hash and shard the data set the lock is > protecting - ie a lock per shard. > > On Mar 13, 2025, at 10:52 PM, atomly wrote: > >  > > On Thu, Mar 13, 2025 at 20:29 Jason E. Aten

[go-nuts] Re: Can't figure out why simple mockserver doesn't hit the handler

2025-03-14 Thread Jason E. Aten
Typically http servers start a goroutine per client. If your mock server is doing that (without seeing the code, we cannot tell), a debugger won't step between the client and server goroutines. Put print statements in to tell what is actually happening. I have a little library I use constantly

Re: [go-nuts] sharded rw mutex approaches?

2025-03-14 Thread Jason E. Aten
things like concurrent skip lists and for large data sets > with persistence, log sequential merge trees. > > On Mar 14, 2025, at 1:20 AM, Jason E. Aten wrote: > > (If that seems surprising, the reason is mentioned in the sibling c++ > library announcement: > > "p

Re: [go-nuts] sharded rw mutex approaches?

2025-03-14 Thread Jason E. Aten
e Java concurrent hash map would be an applicable > design. > > You can see some of this - not nearly as good or complete - in my > github.com/robaho/go-concurrency-test > > On Mar 14, 2025, at 12:17 AM, Jason E. Aten wrote: > > oh nice. I like the hashing idea to pic

Re: [go-nuts] sharded rw mutex approaches?

2025-03-13 Thread Jason E. Aten
ave-memory-and-time.html ... so the game turns into how few pointers you can chase. Turns out in memory b-trees are great for this. On Friday, March 14, 2025 at 6:09:56 AM UTC Jason E. Aten wrote: > I do keep seeing references to Java concurrent stuff people are porting to > Go. I have

[go-nuts] sharded rw mutex approaches?

2025-03-13 Thread Jason E. Aten
Is there a common way to do sharded read-write locks now? I mean faster than sync.RWMutex. I tried https://github.com/jonhoo/drwmutex which is from quite a while back... ...and it was pretty good! reducing L1 cache misses (perf measured) by a little over 1% was enough to make the benchmark code

[go-nuts] Re: Networking in Go

2025-03-12 Thread Jason E. Aten
on pooling, TLS handshakes, and distributed erasure coding. Understanding how these pieces fit together, especially in the context of high-performance storage systems, is where I’m struggling. On Tuesday, March 11, 2025 at 12:16:59 AM UTC+5:30 Jason E. Aten wrote: Hi Kanak. You'll get better

[go-nuts] Re: Networking in Go

2025-03-11 Thread Jason E. Aten
Hi Kanak. You'll get better answers with a little bit longer description of what specifically you want to learn. Just "networking" is too broad a topic to offer any concise guidance--its like saying "I want to know about 'life', or 'the earth', or 'the internet'". What problems do you face? What

[go-nuts] "Nice Trie Mister"

2025-03-11 Thread Jason E. Aten
Who can resist a good trie pun? I put my combined ART (adaptive radix trie) + Order-Statistics tree up on github. It is a nice sorted key/value alternative to red-black trees. Some unique features: You can iterate and delete at the same time. I tend to need to do this often. Especially delet

[go-nuts] Re: 1.24+ FIPS support

2025-03-04 Thread Jason E. Aten
Hi Jussi, I think (I could be wrong though) that is Filippo's project https://filippo.io/. I don't recall him frequenting golang-nuts, so you might try to converse with him more directly. On Tuesday, March 4, 2025 at 5:35:29 PM UTC Jussi Nummelin wrote: > Hey, > > I was pleasantly surprised to

[go-nuts] Re: Library for root finding of single-valued real functions?

2025-03-04 Thread Jason E. Aten
I can't speak to canon (the intersection of Gophers and numerical people is already the intersection of two small niches...so there's not a whole lotta canon), but Brent's method is standard stuff straight out of Numerical Recipes, Section 9.3, page 352 https://s3.amazonaws.com/nrbook.com/book_

Re: [go-nuts] Golang JPEG2000 implementation / Gauging community interest in supporting it?

2025-03-03 Thread Jason E. Aten
Have you seen the headline numbers on patent suit awards? Violating patents can run you 100s of millions of dollars -- not joking. There are whole businesses with winning patent cases as their sole aim. You might naively think that any patents should have expired since its been more than 17 years

[go-nuts] serializations that support generics?

2025-02-26 Thread Jason E. Aten
Are there serialization formats that support Go generics? I'd like to take a look at how they do it, if they exist. I'm wondering: Do they use reflection at runtime? and/or: Do they parse the source looking for template instantiations at go:generate time to codegen for all possible instantiatio

Re: [go-nuts] Re: Exposing newcoro/coroswitch

2025-02-25 Thread Jason E. Aten
If so, perhaps > you could substitute a chan for the slice and send the processor off to do > its thing in a goroutine. In that case, you would only need a utility > function to adapt a channel to a iter.Seq. > > On Tue, Feb 25, 2025 at 9:17 AM Nuno Cruces wrote: > >

[go-nuts] Re: Is there a pure Go implementation for the Hypergeometric function?

2025-02-25 Thread Jason E. Aten
I'm not aware of one; doesn't mean a github/web search wouldn't find one though. I usually start by looking in gonum (https://www.gonum.org/ and https://github.com/gonum/gonum ) Sadly, it appears however they don't have it: https://github.com/gonum/gonum/issues/649 Generally you end up having

[go-nuts] Re: Exposing newcoro/coroswitch

2025-02-25 Thread Jason E. Aten
On Tuesday, February 25, 2025 at 7:57:50 AM UTC Nuno Cruces wrote: I'm… sorry. I don't understand the purpose of this code listing. In my original post I gave a solution to my own problem implemented in two ways: with goroutines and channels, and with newcoro and coroswitch. If you're trying to

Re: [go-nuts] Re: Exposing newcoro/coroswitch

2025-02-25 Thread Jason E. Aten
On Tuesday, February 25, 2025 at 4:29:44 AM UTC Robert Engels wrote: You don’t need co routines if you have real concurrency. The generator use case is simply an optimization that wouldn’t be necessary if the concurrency model was more efficient - and there was a more expressive way to use it.

[go-nuts] Re: Exposing newcoro/coroswitch

2025-02-24 Thread Jason E. Aten
I don't understand the tradeoffs involved, so I can't speak to the hesitancy to release coroutines. They would probably be great fun to play with. I imagine, however, they would provide ample foot-guns too. Perhaps that is a part of the reason. I find reading coroutine code in Lua, for example,

Re: [go-nuts] runtime.AddCleanup and C struct hierarchies: cleanup order?

2025-02-20 Thread Jason E. Aten
Usually depth-first-search works just fine. On Wednesday, February 19, 2025 at 9:25:22 PM UTC Tom wrote: Thank you for the super-fast and authoritative response! OK, I will work on an alternative solution for cleaning up hierarchies in bottom-up order and will report back here if/when I find a

[go-nuts] the wasm32 challenge

2025-02-16 Thread Jason E. Aten
If someone wants a nice, hard challenge that would benefit Go and Go extension work dramatically, the next stage of wasm support (called wasm32) has been blocked for about a year, waiting for some issues/crashes to be figured out. https://github.com/golang/go/issues/63131 https://go-review.google

Re: [go-nuts] parallel blake3, broadcast non-zero values, wait-groups integrated with chan

2025-02-15 Thread Jason E. Aten
2:20:44 PM UTC Nagaev Boris wrote: > On Thu, Feb 13, 2025 at 6:11 PM Jason E. Aten wrote: > > > 3) I almost always need to know when my goroutines are done, > > > > and to shut them all down in case of an error from one. > > > > > > My idem package provides

Re: [go-nuts] Using errors.As error-prone

2025-02-14 Thread Jason E. Aten
Ah. Yes, of course. Pointers always. I was trying to suggest that creating your own error structs in the first place opens a needless Pandora's box. It is just extra trouble that is trivially avoided if you simply think of errors as strings, and create them only with fmt.Errorf(). Certainly the

Re: [go-nuts] Using errors.As error-prone

2025-02-14 Thread Jason E. Aten
> On Fri, 14 Feb 2025 at 14:24, Axel Wagner > wrote: > >> On Fri, 14 Feb 2025 at 14:05, Jason E. Aten wrote: >> >>> I myself still use the classic string based-errors as >>> original designed. >>> >> >> I'm not sure what you

Re: [go-nuts] Using errors.As error-prone

2025-02-14 Thread Jason E. Aten
On Fri, 14 Feb 2025 at 14:24, Axel Wagner wrote: On Fri, 14 Feb 2025 at 14:05, Jason E. Aten wrote: I myself still use the classic string based-errors as original designed. I'm not sure what you mean here. I'm sorry I confused you. I'm not doing anything tricky or sophis

Re: [go-nuts] Using errors.As error-prone

2025-02-14 Thread Jason E. Aten
I myself still use the classic string based-errors as original designed. These are immutable values that are easy to compare with == and search with strings.Contains(). I don't think there is a wide accepted best practice here. There are libraries like "errors" but to me wrapping errors is grat

Re: [go-nuts] input directly from cli after a function

2025-02-13 Thread Jason E. Aten
If you want to mix flags and "unflagged" arguments, like your integer, see the flag package. "After parsing, the arguments following the flags are available as the slice flag.Args or individually as flag.Arg(i). The arguments are indexed from 0 through flag.NArg-1." https://pkg.go.dev/flag Yo

[go-nuts] parallel blake3, broadcast non-zero values, wait-groups integrated with chan

2025-02-13 Thread Jason E. Aten
Some of my recent work may be of general interest. Here are three open-source contributions that have gotten new features of late: 1) A fully parallel (multiple goroutines used) Blake3 cryptographic hash, with AVX hardware acceleration. This is probably the fastest cryptographic hash you

Re: [go-nuts] When are two channels equal?

2025-01-21 Thread Jason E. Aten
Thanks Dan. Also I was mixing up "comparable" and "actually being equal", as in == returning true. I think comparable just means "will compile without error". On Wednesday, January 22, 2025 at 7:10:10 AM UTC Dan Kortschak wrote: > On Tue, 2025-01-21 at

[go-nuts] When are two channels equal?

2025-01-21 Thread Jason E. Aten
Reading https://go.dev/ref/spec#Comparison_operators , I come across the interesting but a little ambiguous definition of equality of channels: *"Channel types are comparable. Two channel values areequal if they were created by the same call to make orif both have value nil." (emphasis mine)*

Re: [go-nuts] Issue with Adding Exception Vector Handler in Go

2025-01-19 Thread Jason E. Aten
I would strongly advise avoiding unix-signals from CGO. I've done it and can recommend against it (it needs very elaborate signal masking to avoid crashing the Go runtime); it was still very fraught and probably not supported :) Just catch C-side exceptions in C, turn them into strings, pass t

[go-nuts] Re: Golang ORM Performances

2024-12-21 Thread Jason E. Aten
Bhavesh, Go is great for big projects. You don't say specifically which part is slow, nor which database you are using, so it is hard to give specific advice. You should measure and profile to see what part of your process is taking a long time. Go has great profiling tools. That's one of the re

Re: [go-nuts] Golang ORM Performances

2024-12-19 Thread Jason E. Aten
If you want to avoid boilerplate and keep the lightest weight possible, you could have a look at the approach I took recently when I added SQL support in my serialization format, greenpack. See here: (only supports MariaDB/MySQL syntax at the moment) https://github.com/glycerine/greenpack?tab=re

  1   2   3   4   >