Re: [go-nuts] Re: KeepAlive with net.Listen

2024-02-11 Thread Robert Engels
ed earlier, objective is to create a web server without using net/http, instead directly reading from the socket connection.On Sunday, February 11, 2024 at 4:49:09 PM UTC-8 Robert Engels wrote:If you have http keep alive on - either side should block when reading - it is a full duplex connection

Re: [go-nuts] Re: KeepAlive with net.Listen

2024-02-11 Thread Robert Engels
y, February 11, 2024 at 2:30:44 PM UTC-8 Robert Engels wrote:There is no such thing as a pool of idle connections at the tcp level. As each side of the connection is bound to a specific port on both ends and can’t be unbound. You may be referring to http over tcp where the client and server do not

Re: [go-nuts] Re: KeepAlive with net.Listen

2024-02-11 Thread Robert Engels
There is no such thing as a pool of idle connections at the tcp level. As each side of the connection is bound to a specific port on both ends and can’t be unbound. You may be referring to http over tcp where the client and server do not close the connection after each request - they keep it open f

Re: [go-nuts] help with thread limit

2024-01-31 Thread Robert Engels
You can use cpuctrl or similar to limit the number of visible cores when you start the process. On Jan 31, 2024, at 8:43 PM, Steve Roth wrote:I am running Go code on a shared web hosting server from a major hosting company.  Using cgroups, they limit the number of threads any user can create to 2

Re: [go-nuts] Re: Good examples of Go back ends?

2024-01-22 Thread Robert Engels
github.com/robaho/go-trader has many easy to follow examples - authentication, multicast , routing, rest apis, websockets. A major system not covered though is db access. On Jan 22, 2024, at 9:23 AM, george looshch wrote:hi Jason,thanks a million for pointing out the vagueness of my question! Eng

Re: [go-nuts] Re: does anyone have an example of a Go kernel module

2024-01-07 Thread Robert Engels
Hasn’t been touched in 6 years and it doesn’t work. I guess they figured out it wasn’t worth the effort. The only plausible way to write a kernel module in Go is… don’t.Maybe run a user space Go process and some sort of shared memory communication. On Jan 7, 2024, at 8:06 PM, Hữu Hà wrote:Maybe y

Re: [go-nuts] How to convert a net.Addr into a netip.AddrPort ?

2023-12-24 Thread Robert Engels
github.com/robaho/go-trader has udp multicast support with both server and client codeOn Dec 24, 2023, at 11:05 AM, christoph...@gmail.com wrote:Hello,I'm developping a UDP client server program. Everything is clear on the server side. I'm just a bit confused with the client side. In C we can spe

Re: [go-nuts] Mutex contention in sql.Close()

2023-12-13 Thread robert engels
It is contending with sql.rows.awaitDone(). My guess is that when you close rows it has to wait for db acknowledgement - that this is a false positive based on wall time and not cpu time - that the mutex is waiting for the cleanup operation to complete. > On Dec 13, 2023, at 1:25 PM, Joshua Gar

Re: [go-nuts] detecting deleted file that is still open and appending without error in Go?

2023-12-10 Thread Robert Engels
, 2023 at 6:30:11 PM UTC Robert Engels wrote:Not sure how you are detecting that the append it not working - I noticed that the binary log was not growing, and its update timestamp was not changing. I have an alias, lh, that is alias lh='ls -alFtrh|tail'that I run regularly in the course

Re: [go-nuts] detecting deleted file that is still open and appending without error in Go?

2023-12-10 Thread Robert Engels
Not sure how you are detecting that the append it not working - it usually does because a client can relink the inode to another file name using a syscall I think what you want to do it either 1. Open the file exclusively so git cannot do this. 2. Check that the file create time is the same a

Re: [go-nuts] Re: Is "When in doubt, use a pointer receiver" misleading advice?

2023-11-15 Thread Robert Engels
saying - just use pointer receivers - woefully underestimates the work to do shared concurrent code correctly. > On Nov 15, 2023, at 10:33 AM, Marvin Renich wrote: > > * Robert Engels [231114 21:55]: >> Switching to pointer receivers everywhere actually makes this worse. Any

Re: [go-nuts] Re: Is "When in doubt, use a pointer receiver" misleading advice?

2023-11-14 Thread Robert Engels
assertion — if you fix it to work correctly by using RPC.version(*rpc)— but that is actually a different concern than I and I think Robert Engels were discussing.  Your example above calls a method directly on the struct, we were discussing calling via an interface. Given that Go already performs some

Re: [go-nuts] Re: Is "When in doubt, use a pointer receiver" misleading advice?

2023-11-13 Thread Robert Engels
Lastly, the only reason that changing to a pointer receiver “solves” the race is because the field in the object isn’t accessed - something the compiler could detect in the other version as well. > On Nov 13, 2023, at 10:50 PM, Robert Engels wrote: > > Similarly, even in a single

Re: [go-nuts] Re: Is "When in doubt, use a pointer receiver" misleading advice?

2023-11-13 Thread Robert Engels
Similarly, even in a single threaded Java program objects are copied/moved behind the scenes - these don’t generate race conditions as the runtime ensures there isn’t one. > On Nov 13, 2023, at 10:47 PM, Robert Engels wrote: > > To me this is a limitation of the compiler. If

Re: [go-nuts] Re: Is "When in doubt, use a pointer receiver" misleading advice?

2023-11-13 Thread Robert Engels
To me this is a limitation of the compiler. If a passed argument is unused it doesn’t even need to be created. Similarly if only a few fields are used in a called function a sparse data object can be sent. It only becomes a race if the data being copied is actually used - then the race is also o

Re: [go-nuts] Writing bitmap data to a canvas with WebAssembly

2023-11-07 Thread robert engels
Your numbers do not make sense. At 300 us a frame, it would be more than 3k frames a second - which would only be possible for an extremely tiny area. You need to include the time to produce the data when considering “render time” - otherwise you are talking apples and oranges. > On Nov 7, 202

Re: [go-nuts] Re: Recommended way to distribute pre-compiled C-dependencies for modules using CGO ?

2023-11-03 Thread Robert Engels
Better to rewrite the native portions in Go. If you’re not going to do that, just give instructions on how to build and let the app builder figure out how to package it. > On Nov 3, 2023, at 1:47 PM, Jason E. Aten wrote: > >  > It is still rough around lots of edges, but you are wanting to

Re: [go-nuts] Re: database/sql: Latency when calling DB.QueryContext()

2023-11-03 Thread Robert Engels
The internet. The gift that keeps on giving. > On Nov 3, 2023, at 7:54 AM, Al Corona wrote: > > Off topic question. But does anyone know how I can gain admin access on my > work computer? > >> On Thursday, June 29, 2017 at 12:01:16 AM UTC-7 Kai Zhang wrote: >> Go version 1.8.3 >> >> In DB.

Re: [go-nuts] Suggestions on optimizing Go GC

2023-10-31 Thread Robert Engels
that others have mentioned. You may have an an allocation pattern that needs a generational collector which Go doesn’t offer. > On Oct 31, 2023, at 12:47 AM, Zhihui Jiang wrote: > >  > > On Monday, October 30, 2023 at 10:12:08 PM UTC-7 Robert Engels wrote: > What is the aver

Re: [go-nuts] Suggestions on optimizing Go GC

2023-10-30 Thread Robert Engels
What is the average wall time of a request? Based on what you wrote it appears that handling a single request generates a lot of garbage - high allocation rate - and for this to be significant I suspect the runtime is also significant - which implies to me a spawn and destroy request handler is

Re: [go-nuts] Suggestions on optimizing Go GC

2023-10-29 Thread Robert Engels
If the objects are created and discarded you might be able to spawn a new process to handle the request - or maybe a bunch - then just kill it and start a new process. Possibly use shared memory for constant data. This is the poor man’s generational garbage collector. > On Oct 29, 2023, at 9:

Re: [go-nuts] Re: Is it expected that signal.NotifyContext() changes the execution thread?

2023-10-03 Thread Robert Engels
Almost all graphics systems are single threaded. Some allow additional non rendering event loops but with heavy restrictions that GUI components are only accessed on the main event loop thread. > On Oct 3, 2023, at 2:00 AM, 'wagner riffel' via golang-nuts > wrote: > > On Tue Oct 3, 2023 at

Re: [go-nuts] Re: Help with WASM performance

2023-09-22 Thread Robert Engels
Typically WASM performance is compared to JavaScript - ie. faster than JavaScript usually 1.5-10x. People don’t usually compare WASM with native apps. > On Sep 22, 2023, at 7:04 PM, Robert Engels wrote: > >  > WASM goes through the browser - so it is very different. Are you

Re: [go-nuts] Re: Help with WASM performance

2023-09-22 Thread Robert Engels
xcept for the change of architecture. > The size of the difference in performance is unexpected to me but maybe it's > normal. > >> On Friday, 22 September 2023 at 20:16:20 UTC+1 Robert Engels wrote: >> When you say negative performance are you talking about a native app

Re: [go-nuts] Re: Help with WASM performance

2023-09-22 Thread Robert Engels
When you say negative performance are you talking about a native app running directly on the hardware what are you referring to exactly > On Sep 22, 2023, at 1:03 PM, Stephen Illingworth > wrote: > >  > I've been thinking some more about this problem this week. I found the > performance prof

Re: [go-nuts] x/mobile: avoid to catch sigabort signal

2023-09-10 Thread Robert Engels
This most likely means your other code is corrupting the go runtime/heap/stack. I would run other tests on this code exclusively (asan, etc). > On Sep 10, 2023, at 12:54 PM, Danilo bestbug > wrote: > >  > Hey TheDiveO, thanks for answering. > My focus is not to hide the signal but I would

Re: [go-nuts] Re: Best IDE for GO ?

2023-08-26 Thread Robert Engels
Sorry that was snotty. Bring back the punch cards to really prove who’s a great developer! > On Aug 26, 2023, at 4:29 PM, Robert Engels wrote: > >  > Or you click on the top stack line in an IDE and then arose down. > > It’s like some people want to go back to horse and

Re: [go-nuts] Re: Best IDE for GO ?

2023-08-26 Thread Robert Engels
Or you click on the top stack line in an IDE and then arose down. It’s like some people want to go back to horse and buggy “because it was better for the environment”. Balancing competing priorities is a great skill to have. > On Aug 26, 2023, at 3:51 PM, Justin Israel wrote: > >  > > >>

Re: [go-nuts] Best IDE for GO ?

2023-08-23 Thread Robert Engels
and thermodynamics at all. > >> On Sunday, August 20, 2023 at 1:57:22 PM UTC+2 Robert Engels wrote: >> MIT = “that education place” is pretty funny. But you’re spot on. >> >>>> On Aug 20, 2023, at 2:51 AM, TheDiveO wrote: >>>> >>> That education pla

Re: [go-nuts] Best IDE for GO ?

2023-08-20 Thread Robert Engels
veO wrote: > > well, our "(major) engineering orgs" leave the choice of IDE to our devs. > Devs have different styles, so as long as they meed the demand, who cares. > >> On Saturday, August 19, 2023 at 11:17:35 PM UTC+2 Robert Engels wrote: >> Reread what I wro

Re: [go-nuts] Best IDE for GO ?

2023-08-20 Thread Robert Engels
4:38 PM UTC+2 Andrew Harris wrote: >> The kinds of skills and knowledge covered by https://missing.csail.mit.edu >> are important and hard to gain from an IDE. I think that's the badge of >> competence earned here. >> >> On Saturday, August 19, 2023 at 11:21:44 AM

Re: [go-nuts] Best IDE for GO ?

2023-08-19 Thread Robert Engels
Reread what I wrote. Vim with autocomplete, etc is not a simple text editor with syntax coloring. Still every major software engineering org in the world uses an ide (or multiple). I guess they don’t know what they are doing. Btw, Googles current IDE is based on VSCode. > On Aug 19, 2023, a

Re: [go-nuts] Best IDE for GO ?

2023-08-19 Thread Robert Engels
19, 2023, at 1:54 PM, Andrew Harris wrote: > > The kinds of skills and knowledge covered by https://missing.csail.mit.edu > are important and hard to gain from an IDE. I think that's the badge of > competence earned here. > > On Saturday, August 19, 2023 at 11:21:44 AM

Re: [go-nuts] Best IDE for GO ?

2023-08-19 Thread Robert Engels
The power of IDEs is the ease of refactoring and integration with other build tools (git, lint, github/gerrit). If you’d added all of these plugins to vim - you’ve created your own ide - and it probably pales in comparison to a real IDE.Using plain vim as a badge of competence was disproven long ag

Re: [go-nuts] Best IDE for GO ?

2023-08-19 Thread Robert Engels
I would just have chatgpt write all your Go code. > On Aug 19, 2023, at 7:41 AM, peterGo wrote: > >  > On Saturday, August 19, 2023 at 6:23:39 AM UTC-4 TheDiveO wrote: > Nothing better than an IBM card puncher as my IDE! > > I prefer a Teletype Model 33 ASR. > > -- > You received this me

Re: [go-nuts] Error handling

2023-07-31 Thread robert engels
For some perspective. Go’s error handling mimics C (for the most part). They had a decade to decide how to improve the error handling when they designed C++. They came up with exceptions. Java is C++ like. They had a decade to improve error handling. They came up with exceptions + throws. The G

Re: [go-nuts] Please consider voting to reopen Golang subreddit

2023-06-24 Thread Robert Engels
I’m fairly certain Reddit will license those tools for moderators use. That is not what they are trying to prevent. > On Jun 24, 2023, at 8:39 AM, Wojciech S. Czarnecki wrote: > > Dnia 2023-06-23, o godz. 23:50:32 > Amnon napisał(a): > >> Sorry, but I have been away and missed the context.

Re: [go-nuts] Locking (`__GI___pthread_mutex_unlock`) takes most of the execution time when using cgo with large number of CPUs

2023-06-20 Thread robert engels
Since this is an initialization guard - can’t it simply be double checked with an atomic flag? > On Jun 20, 2023, at 9:04 AM, Ian Lance Taylor wrote: > > On Tue, Jun 20, 2023 at 5:32 AM Bảo Phan Quốc wrote: >> >> I'm using cgo to call a C function from Go. Inside the C function there is a >>

Re: [go-nuts] Re: [RFC] Yet another proposal for Go2 error handling

2023-06-18 Thread Robert Engels
venient / portable -- for instance for IDEs; also > I'm often coding in a Jupyter Notebook using GoNB, which would also need > modifications. Better if there was some form of support for the language. I'm > hoping some error handling proposal would cover this use case. > >

Re: [go-nuts] Re: [RFC] Yet another proposal for Go2 error handling

2023-06-18 Thread Robert Engels
Seems the easiest way to address that is with a DSL and a code generator. > On Jun 18, 2023, at 9:47 AM, Jan Pfeifer wrote: > >  > hi Shulhan, I see your points, thanks for the reply. Let me comment on them > below: > >> On Sat, Jun 17, 2023 at 9:21 AM Shulhan wrote: >> Hi Jan, thanks for

Re: [go-nuts] is running interactive or not

2023-06-10 Thread Robert Engels
No need to even think about this. Look at ssh and mimic their practices. It has been thoroughly audited. > On Jun 10, 2023, at 5:35 AM, quin...@gmail.com wrote: > > there has been much discussion in the past about programs that modify their > behaviour depending on what stdout is; > http://

Re: [go-nuts] Can we further optimize the scheduling order of goroutines in sync.Mutex?

2023-06-05 Thread Robert Engels
That is implicit since the list of waiters is ordered. > On Jun 5, 2023, at 7:08 AM, fliter wrote: > > Thanks for your answer. But I wonder if the elements behind the queue may > wait for a very long time? Can we maintain a waiting time after entering the > queue for each coroutine, and acqu

Re: [go-nuts] Re: Lots of retained free spans

2023-05-29 Thread Robert Engels
Go GC does not use a compacting/copying collector so depending on your allocation patterns you could see this behavior. But you’re stating > 70% free spade available. I.e It may be that these are holes that cannot be released to the OS. > On May 29, 2023, at 10:08 AM, Gleb Petrovichev > wro

Re: [go-nuts] Re: HTTP client timeout

2023-05-05 Thread Robert Engels
I mean you can use curl to simulate the 1000’s of clients (depending on protocol dependencies) > On May 5, 2023, at 9:23 AM, envee wrote: > > Hi Robert, Yes I have tried HTTP request via curl. That yields a response in > about 200ms. > >> On Friday, 5 May 2023 at 2

Re: [go-nuts] Re: HTTP client timeout

2023-05-05 Thread Robert Engels
Have you tried using curl as the client in order to narrow down the problem? > On May 5, 2023, at 7:45 AM, envee wrote: > > An update. > The VM on which I am running has 40 vCPUs. > I changed my GOMAXPROCS to a lower value of 8. > And also changed my client to use 90 HTTP/2 connections towards

Re: [go-nuts] Re: Short Variable Declarations Are Oversold

2023-04-24 Thread Robert Engels
If you use Go’s “accept interfaces return concrete types” the dev/ide knows to declare the concrete type. Type inference can actually cause more issues during refactorings - not alleviate them. Personally, I find types make the code easier to read. But when I write ago I don’t use them. I fi

Re: [go-nuts] Short Variable Declarations Are Oversold

2023-04-23 Thread Robert Engels
ner > wrote: >  > > > On Sun, Apr 23, 2023 at 4:01 PM Robert Engels wrote: >> Personally that syntax has always bothered me with readability. It requires >> lots of previous knowledge in some cases. A syntax like >> >> x, var y int = blah >>

Re: [go-nuts] Short Variable Declarations Are Oversold

2023-04-23 Thread Robert Engels
To clarify, the semantics of a go statement from a language perspective changes based on earlier statements. That is simply weird - and hurts readability. > On Apr 23, 2023, at 9:01 AM, Robert Engels wrote: > >  > Personally that syntax has always bothered me with readability.

Re: [go-nuts] Short Variable Declarations Are Oversold

2023-04-23 Thread Robert Engels
Personally that syntax has always bothered me with readability. It requires lots of previous knowledge in some cases. A syntax like x, var y int = blah Is more explicit that x is reused and y is declared. Go is all about being explicit until it isn’t. > On Apr 23, 2023, at 8:28 AM, 'Axel W

Re: [go-nuts] Improving IPC latency?

2023-04-09 Thread Robert Engels
Linux context switch is 6-7 usec. Usually it is more cache invalidation that causes the whole code to run slow. Usually spinning is the only solution and core/cpu isolation. > On Apr 9, 2023, at 1:33 PM, TH wrote: > > Hey, > > I'm building a software which handles hundred-ish concurrent net

Re: [go-nuts] Need help: Calling panic() is corrupting system stack

2023-04-04 Thread robert engels
t_cgo_panichttps://github.com/MariappanBalraj/test_cgo_panic.githttps://github.com/MariappanBalraj/test_cgo_panic/archive/refs/heads/main.zipBest RegardsMariappanOn Mon, Apr 3, 2023 at 9:50 AM Robert Engels <reng...@ix.netcom.com> wrote:I would start by publishing a small reproducible test case on gith

Re: [go-nuts] Interesting "select" examples

2023-04-03 Thread Robert Engels
Interesting - that page has “ Thread stacks are allocated in shared memory, making it valid to pass pointers to stack variables between threads and procs.” That seems very difficult to pull off safely. > On Apr 3, 2023, at 9:46 PM, Skip Tavakkolian > wrote: > > On Mon, Apr 3, 2023 at 5:22 PM

Re: [go-nuts] Interesting "select" examples

2023-04-03 Thread Robert Engels
:28 PM, Nigel Tao wrote: > On Tue, Apr 4, 2023 at 11:22 AM Robert Engels wrote: >> the processing often involves subsequent stages operating on a subset of the >> original channels based on the earlier. > > I get that, in theory. Rob's pause channel is a simple examp

Re: [go-nuts] Interesting "select" examples

2023-04-03 Thread Robert Engels
PM, Nigel Tao wrote: > > On Tue, Apr 4, 2023 at 10:13 AM Robert Engels wrote: >> I think it is as simple as looking at kselect/poll in posix. Each descriptor >> can be viewed as an independent channel of info/objects. >> >> Select with Go channels works similarly and

Re: [go-nuts] Interesting "select" examples

2023-04-03 Thread Robert Engels
I think it is as simple as looking at kselect/poll in posix. Each descriptor can be viewed as an independent channel of info/objects. Select with Go channels works similarly and has similar usefulness. > On Apr 3, 2023, at 7:00 PM, Nigel Tao wrote: > > On Mon, Apr 3, 2023 at 8:14 PM Rob Pik

Re: [go-nuts] Need help: Calling panic() is corrupting system stack

2023-04-02 Thread Robert Engels
I would start by publishing a small reproducible test case on github that fully compiles that demonstrates the issue. > On Apr 2, 2023, at 10:59 PM, mariappan balraj > wrote: > >  > Hello Go Experts, > > It is good if someone can help on this? > > Best Regards > Mariappan >> On Sat, Apr 1

Re: [go-nuts] How to encode/decode string to binary in golang

2023-03-13 Thread robert engels
Am arbitrary byte can be encoded in 2 HEX characters - only a 2x increase in size not 8x. > On Mar 13, 2023, at 2:35 PM, Volker Dobler wrote: > > On Monday, 13 March 2023 at 17:41:42 UTC+1 Van Fury wrote: > Relating to my previous question, I have been reading but it is still not > clear to me

Re: [go-nuts] Detecting / Avoiding network bottleneck when sending concurrent HTTP requests to many hosts.

2023-03-06 Thread Robert Engels
Have you used netstat to check how many open connections you have? You probably need to forcibly close them so they don’t end up in time wait states. Also, you don’t say what N is? Lastly you will get different errors for a dns or host error than a resources exhausted. If you configure the max

Re: [go-nuts] go --> wasm: syscall.Mmap

2023-02-17 Thread Robert Engels
See https://github.com/WebAssembly/WASI/issues/304 > On Feb 17, 2023, at 2:44 PM, Robert Engels wrote: > > You must like need to use WASI - but it doesn’t support mmap :( > >>> On Feb 17, 2023, at 2:37 PM, Ian Lance Taylor wrote: >>> >>> On Fri, Feb 1

Re: [go-nuts] go --> wasm: syscall.Mmap

2023-02-17 Thread Robert Engels
You must like need to use WASI - but it doesn’t support mmap :( > On Feb 17, 2023, at 2:37 PM, Ian Lance Taylor wrote: > > On Fri, Feb 17, 2023 at 9:11 AM Stan Srednyak wrote: >> >> thanks for your reply. >> The Mmap functionality is crucial for my app. I am dealing with large binary >> tree

Re: [go-nuts] Re: Upgradable RLock

2023-02-13 Thread Robert Engels
ConcurrentHashMap works that way in Java. Multiple write locks on portions of the table and CAS/atomic reading. > On Feb 13, 2023, at 1:45 PM, 'drc...@google.com' via golang-nuts > wrote: > > Could you use an applicative data structure? (e.g., a balanced binary tree > where you allocate a n

[go-nuts] Re: Re-entrant locks?

2023-02-07 Thread Robert Engels
And you have to make sure that a ctx is not incorrectly shared… ugh. > On Feb 7, 2023, at 7:41 AM, Robert Engels wrote: > > I know this topic comes up a bit and I’ve done a bit more research. > > Is a contributing reason that Go does not have re-entrant locks is that Go >

[go-nuts] Re-entrant locks?

2023-02-07 Thread Robert Engels
I know this topic comes up a bit and I’ve done a bit more research. Is a contributing reason that Go does not have re-entrant locks is that Go does not have any way to get Go routine identity? It seems you cannot write a reentrant lock - at least not with the typical syntax - without specialize

Re: [go-nuts] Upgradable RLock

2023-02-04 Thread robert engels
t;> wrote: > > On Sat, Feb 4, 2023 at 3:24 PM Robert Engels <mailto:reng...@ix.netcom.com>> wrote: >> >> That only works if what it is pointing to is cheap to copy. If it is a large >> multi-layer structure a RW lock is usually more efficient. > > No signifi

Re: [go-nuts] Upgradable RLock

2023-02-04 Thread Robert Engels
That only works if what it is pointing to is cheap to copy. If it is a large multi-layer structure a RW lock is usually more efficient. > On Feb 4, 2023, at 5:19 PM, Ian Lance Taylor wrote: > > On Sat, Feb 4, 2023 at 3:11 PM Robert Engels wrote: >> >> I think with se

Re: [go-nuts] Upgradable RLock

2023-02-04 Thread Robert Engels
3 at 8:49 AM robert engels wrote: >> >> I took some time to put this to a test. The Go program here >> https://go.dev/play/p/378Zn_ZQNaz uses a VERY short holding of the lock - >> but a large % of runtime holding the lock. >> >> (You can’t run it on the Playg

Re: [go-nuts] Upgradable RLock

2023-02-04 Thread Robert Engels
er reading their patent and > looking at the kernel implementation and thinking to myself how brilliant the > concept was. > >> On Sat, Feb 4, 2023 at 8:49 AM robert engels wrote: >> I took some time to put this to a test. The Go program here >> https://go.dev/pl

Re: [go-nuts] Upgradable RLock

2023-02-04 Thread robert engels
x. It is easy to understand why - you get no parallelization of the readers when using a simple Mutex. > On Jan 30, 2023, at 8:29 PM, Ian Lance Taylor wrote: > > On Mon, Jan 30, 2023 at 4:42 PM Robert Engels wrote: >> >> Yes but only for a single reader - any concurre

Re: [go-nuts] please continue High Sierra mac OSX support

2023-02-03 Thread Robert Engels
t 9:40 AM robert engels wrote: >> >> I’d like to understand this a bit better as well. I currently develop an OSX >> app using Xcode/Obj-C and it runs all the way back to 10.9 (I recently >> raised the requirement from 10.7). >> >> Is the restriction only that th

Re: [go-nuts] please continue High Sierra mac OSX support

2023-02-03 Thread robert engels
I’d like to understand this a bit better as well. I currently develop an OSX app using Xcode/Obj-C and it runs all the way back to 10.9 (I recently raised the requirement from 10.7). Is the restriction only that the Go tool chain needs 10.15, but the produced binaries will work on an earlier ve

Re: [go-nuts] Upgradable RLock

2023-01-30 Thread Robert Engels
Yes but only for a single reader - any concurrent reader is going to park/deschedule. There’s a reason RW locks exist - and I think it is pretty common - but agree to disagree :) > On Jan 30, 2023, at 6:23 PM, Ian Lance Taylor wrote: > > On Mon, Jan 30, 2023 at 1:00 PM Robert Enge

Re: [go-nuts] Upgradable RLock

2023-01-30 Thread Robert Engels
A quick search found this https://yizhang82.dev/lock-free-rw-lock which describes the algo pretty well. > On Jan 30, 2023, at 3:00 PM, Robert Engels wrote: > > Pure readers do not need any mutex on the fast path. It is an atomic CAS - > which is faster than a mutex as it allow

Re: [go-nuts] Upgradable RLock

2023-01-30 Thread Robert Engels
acquire it whether reading or writing - this is slow…. (at least compared to an atomic cas) > On Jan 30, 2023, at 2:24 PM, Ian Lance Taylor wrote: > > On Mon, Jan 30, 2023 at 11:26 AM Robert Engels wrote: >> >> I don’t think that is true. A RW lock is always better when th

Re: [go-nuts] Upgradable RLock

2023-01-30 Thread Robert Engels
I don’t think that is true. A RW lock is always better when the reader activity is far greater than the writer - simply because in a good implementation the read lock can be acquired without blocking/scheduling activity. > On Jan 30, 2023, at 12:49 PM, Ian Lance Taylor wrote: > > On Sun, Jan

Re: [go-nuts] Creating and Linking to Shared Library Version of Go Runtime?

2023-01-28 Thread Robert Engels
Shared dynamic libraries do reduce the “wear and tear” on an SSD. The binaries are loaded a single time and shared across processes - slightly longer startup times for the dynamic linkage. It is highly beneficial with large runtimes vs small standard library usage in tiny utilities. > On J

Re: [go-nuts] Variable Declaration inside infinite loop

2023-01-26 Thread Robert Engels
Java would no-op that entire loop since it does nothing that is externally visible. > On Jan 26, 2023, at 9:30 AM, Roland Müller wrote: > >  > > Am Mittwoch, 25. Januar 2023 schrieb 'Jakob Borg' via golang-nuts > : > > On 25 Jan 2023, at 12:26, Shashwat wrote: > >> > >> Is it safe to decla

Re: [go-nuts] Clarification of memory model behavior within a single goroutine

2023-01-22 Thread Robert Engels
son wrote: > >  >> On Mon, Jan 23, 2023 at 12:42 AM robert engels wrote: > >> Write data to memory mapped file/shared memory. Keep track of last written >> byte as new_length; >> >> Use atomic.StoreUint64(pointer to header.length, new_length); >>

Re: [go-nuts] Clarification of memory model behavior within a single goroutine

2023-01-22 Thread robert engels
reuses it. The above must work in order for Go to have a happens before relationship with the atomics - all writes must be visible to a reader that see the updated value in the header. > On Jan 22, 2023, at 12:53 PM, Peter Rabbitson wrote: > > > > On Sun, Jan 22, 2023 at 7:39 P

Re: [go-nuts] Clarification of memory model behavior within a single goroutine

2023-01-22 Thread robert engels
The atomic store will force a memory barrier - as long as the reader (in the other process) atomically reads the “new value”, all other writes prior will also be visible. BUT you can still have an inter-process race condition if you are updating the same memory mapped file regions - and you nee

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

2023-01-15 Thread Robert Engels
This is a very strange discussion. I don’t understand the purpose. Malloc() isn’t even deterministic. Which means any arbitrary program can take the address to generate entropy regardless of having time, etc available. I didn’t look it up, but I’m pretty sure there is a “law” that if the langu

Re: [go-nuts] Re: Debugging memory leak when a GO process crashed

2023-01-12 Thread Robert Engels
You can certainly have memory leaks in Go - due to undesired references retaining the object. What the op is asking for is a memory dump at OOM crash. If the dump shows 1M object X and the author believes there should only be 1 - you have a leak > On Jan 12, 2023, at 4:01 AM, mariappan balr

Re: [go-nuts] how to address security concerns about a JIT

2022-12-18 Thread Robert Engels
If you limit the JIT capabilities a bit - have it compile to a Go plugin and load that. Since you need api boundaries to call into the code anyway - it fits nicely. > On Dec 18, 2022, at 5:10 AM, Jason E. Aten wrote: > >  > > Perhaps I am worrying too much. > > After all, a webserver that

Re: [go-nuts] Achieving C/C++/Rust comparable performance with Golang

2022-12-14 Thread Robert Engels
Same holds true for Java. People have tried What you end up with is Java is name only - so why bother. > On Dec 14, 2022, at 2:47 PM, Ian Lance Taylor wrote: > > On Wed, Dec 14, 2022 at 9:57 AM Kursk wrote: >> >> Go is a high performant garbage collected language, (considered) memory safe

Re: [go-nuts] 'go run hello.go' taking ~30 seconds on windows

2022-12-14 Thread Robert Engels
I am guessing it is a dns resolution issue during startup. See the GODEBUG netdns settings. > On Dec 14, 2022, at 11:57 AM, Declan Finn wrote: > > Hi, > > Platform: Windows 10 > Go Version: 1.19.4 > > Compile and run of the most basic helloworld program is extremely slow on my > windows ma

Re: [go-nuts] Which websockets implementation

2022-12-12 Thread Robert Engels
I personally like minimal packages like this. Makes them easier to tailor/debug if something goes wrong. Also simpler to take ownership/fork if needed - than a package with a ton of code. > On Dec 12, 2022, at 3:14 PM, Amnon wrote: > > By stdlib, you presumably mean the x/net/websocket packa

Re: [go-nuts] Which websockets implementation

2022-12-12 Thread Robert Engels
You can use the stdlib websocket. See https://github.com/robaho/go-trader/blob/master/internal/exchange/webserver.go for an example. > On Dec 12, 2022, at 12:57 PM, Amnon wrote: > > Which websocket implementation would people recommend for a new project, > now that gorilla/websocket has been

Re: [go-nuts] Chromebook golang environment?

2022-12-12 Thread Robert Engels
You can also use remote VMs like GCP to run VSCode. Chrome book works for that. > On Dec 12, 2022, at 8:54 AM, Bruno Albuquerque wrote: > > If you just mean being able to write Go programs in a Chromebook, most > recent ones have Linux support so you can just use that. > >> On Mon, Dec 12, 20

Re: [go-nuts] Re: Why this simple sorting code doesn't work?

2022-12-06 Thread Robert Engels
If you compare indexes then the elements are swapped you have messed up the order. Imagine the first comparison is 0,15 - you have now swapped those elements - there is no guarantee what order the elements are compared in. The index passed in is simply to look up the element. I am supposed th

Re: [go-nuts] Re: Why not tuples?

2022-12-05 Thread Robert Engels
I worked on a system one time - in Java - that used a Sextuplet. I kid you not. Please. Please. Please use typed structures and save the futures maintainers they pain. It’s a little extra work up front that pays big dividends. > On Dec 5, 2022, at 9:39 PM, Diogo Baeder wrote: > >  > Hi folks

Re: [go-nuts] Golang 1.19+ preemption model on a preemptive linux kernel?

2022-12-05 Thread robert engels
I don’t think the analysis by alphadose in the issue you cite is correct. Go added async pre-emption (via signals) and I believe it can preempt a Go thread anywhere but in an internal critical section. Ian would know for sure. It is certainly not only at a function call boundary because that wou

Re: [go-nuts] Re: Looking Backend Dev Learning Resources

2022-12-05 Thread Robert Engels
Can you elaborate on that reference? At first review, it means you are putting in lots of effort making lots of progress (anti red queen) but that would mean the progress made did not invalidate any of effective Go (which seems not possible given the addition of generics). I’m doubting you impl

Re: [go-nuts] Golang 1.19+ preemption model on a preemptive linux kernel?

2022-12-05 Thread Robert Engels
I have some examples of lock-free structures at github.com/robaho/go-concurrency-test Most lock-free structures should not depend on OS scheduling. Some that use “cpu id “ to partition would. > On Dec 5, 2022, at 12:02 PM, Andrew Athan wrote: > > I'm having trouble finding definitive inform

Re: [go-nuts] Re: go install of forked repo

2022-12-05 Thread Robert Engels
As I mentioned in the other thread - isn’t that made more complicated because the module author (the module that is imported) doesnt use relative packages references? If they did wouldn’t this be simpler? > On Dec 5, 2022, at 5:32 AM, Brian Candler wrote: > > Or there is vendoring. > >> On M

Re: [go-nuts] Re: Golang Github Package References

2022-12-05 Thread Robert Engels
The op is trying to say, they wrote the code using github.com/robaho/fixed but then they decide they want to use a fork of fixed (maybe it is being maintained better, performance enhancements, etc) but they don’t want to change all of their code. Can they use a replace directive to point at th

Re: [go-nuts] Re: go install of forked repo

2022-12-04 Thread Robert Engels
Can’t you use a replace directive to use the fork ? > On Dec 4, 2022, at 6:17 AM, Volker Dobler wrote: > > You cannot use a "fork". The Github concept of a "fork" doesn't > work together with the concept of a Go module. > You are free to fork a repo and you can modify the source > after git clo

Re: [go-nuts] Go Memory Model question

2022-12-03 Thread robert engels
happens-before in this case would only guarantee 0, not 1. e.g. change the initializer to x = 3, then 3 must be guaranteed to be seen rather than the default value of 0 > On Dec 2, 2022, at 8:12 AM, burak serdar wrote: > > The way I read the memory model, this program can print 01, 00, and 11,

Re: [go-nuts] gRPC for web applications with millions of users

2022-12-02 Thread robert engels
There are also things like https://github.com/grpc/grpc-web > On Dec 2, 2022, at 11:20 AM, 'Sean Liao' via golang-nuts > wrote: > > See also https://buf.build/blog/connect-web-protobuf-grpc-in-the-browser > > > - sean > > > O

Re: [go-nuts] clarifying Go FAQ: Is Go an object-oriented language?

2022-11-24 Thread robert engels
OO as a fad? This is Thanksgiving not April Fool’s Day. > On Nov 24, 2022, at 3:25 PM, TheDiveO wrote: > > Reading the "yes and no" part as a newcomer to Go actually made me snigger > and I though that this kind of answer shows a thorough and differentiated > thinking not shy of dealing with c

Re: [go-nuts] clarifying Go FAQ: Is Go an object-oriented language?

2022-11-23 Thread robert engels
Your reading comprehension skills need some work. The point of “labels matter” was answering Rob Pike’s “why does it matter” question. I used extremely different objects - yet both modes of transportation - intentionally to highlight the need for common definitions in order to communicate. Th

Re: [go-nuts] clarifying Go FAQ: Is Go an object-oriented language?

2022-11-23 Thread robert engels
I am not sure what you are trying to say here. > On Nov 23, 2022, at 8:36 PM, Holloway Kean Ho > wrote: > > Your examples have something to do with the developer's psychological problem > for failing to distingush between objects; not OO, OOP, or any programming > languages. Neither Java or

<    1   2   3   4   5   6   7   8   9   10   >