[go-nuts] Derivative work licensing

2020-11-15 Thread Mikhail Vladimirov
I'm going to release a fork of a standard library package that was trimmed down and optimized for some niche use case. As far as I understand at the very least I should keep the original LICENSE file. What about the CONTRIBUTORS list? Should I also keep per-file copyright headers? What if a fil

Re: [go-nuts] Re: How does the Golang compiler handle dependencies?

2020-11-15 Thread kev kev
Reading Alekseys description, it does seem to be making a bit more sense. The C/C++ compilers use a "file" as a compilation unit. A file is converted to an object file which must contain all of its dependencies. So the includes will need to copy all of the code that they are importing into the

[go-nuts] gollvm: Issues on Alpine linux. Tentative definition has type 'struct sigstack' that is never completed, in sysinfo.c

2020-11-15 Thread Ivan Serdyuk
Hello. I was trying to check what is required to build gollvm on Alpine linux (it has musl instead of glibc). Look like recently revealed set of minimal requirements allowed to build the configuration file (for Ninja). heading to

Re: [go-nuts] Re: How does the Golang compiler handle dependencies?

2020-11-15 Thread Robert Engels
Object files do not contain dependencies except for code that the compiler inlines. It has linkage referees that are resolved during linking. > On Nov 15, 2020, at 8:05 AM, kev kev wrote: > > Reading Alekseys description, it does seem to be making a bit more sense. > The C/C++ compilers use

Re: [go-nuts] Derivative work licensing

2020-11-15 Thread Ian Lance Taylor
On Sun, Nov 15, 2020 at 4:57 AM Mikhail Vladimirov wrote: > > I'm going to release a fork of a standard library package that was trimmed > down and optimized for some niche use case. As far as I understand at the > very least I should keep the original LICENSE file. What about the > CONTRIBUTOR

Re: [go-nuts] gollvm: Issues on Alpine linux. Tentative definition has type 'struct sigstack' that is never completed, in sysinfo.c

2020-11-15 Thread Ian Lance Taylor
On Sun, Nov 15, 2020 at 7:25 AM Ivan Serdyuk wrote: > > I was trying to check what is required to build gollvm on Alpine linux (it > has musl instead of glibc). > > Look like recently revealed set of minimal requirements allowed to build the > configuration file (for Ninja). > > heading to check

Re: [go-nuts] Re: How does the Golang compiler handle dependencies?

2020-11-15 Thread Aleksey Tulinov
Yeah, that's a good point. A C unit that is using f() won't necessarily include f's implementation if it is defined somewhere else. It may create a (weak?) reference to f() and leave the rest to the linker. However to compile correctly it would *normally* include a header where f() is declared to a

Re: [go-nuts] How to clear current line in terminal

2020-11-15 Thread Stephan Lukits
On 9/19/20 10:45 AM, Alex Mills wrote: [...] this will clear the current line in the terminal, so I can achieve something like a status line, but I cannot figure out how to do this with Golang, anyone know? https://play.golang.org/p/B5ZShtSizEy -- You received this message because you are su

Re: [go-nuts] How to drop old value in a channel salety

2020-11-15 Thread 陶青云
在2020年11月15日星期日 UTC+8 下午12:19:07 写道: > On Sat, Nov 14, 2020 at 7:54 PM Robert Engels > wrote: > >> I don’t think a ring buffer works. At least in a traditional ring buffer >> the producer cannot pass the consumer - if the buffer is full the producer >> blocks or drops. Trying to ensure the co

[go-nuts] Is it possible that a hybrid memory management could be implemented?

2020-11-15 Thread tapi...@gmail.com
For example, some local memory allocations could be detected no used elsewhere so that they can may be freed immediately when out of reach instead of waiting to be freed in the GC phase. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsub

Re: [go-nuts] Is it possible that a hybrid memory management could be implemented?

2020-11-15 Thread Tyler Compton
I may be misunderstanding what you're suggesting, but I believe Go already tries to detect when a value can be placed on the stack. Then, it will be freed automatically when it falls out of scope. On Sun, Nov 15, 2020 at 5:20 PM tapi...@gmail.com wrote: > > For example, some local memory allocat

Re: [go-nuts] Is it possible that a hybrid memory management could be implemented?

2020-11-15 Thread tapi...@gmail.com
Aha, I forgot this fact. You are totally right. It is a bad example. A better example: is it possible to detect that some values are always single-owner (and their out-of-reach time point are also detectable)? On Sunday, November 15, 2020 at 8:23:58 PM UTC-5 xav...@gmail.com wrote: > I may be

[go-nuts] Let Go also support manual memory management, a good or bad idea?

2020-11-15 Thread tapi...@gmail.com
For example, by adding two new built-in functions: alloc and free, garbage collector will ignore the memory allocated by alloc. The memory allocated by alloc must be freed by calling the free function manually. This would relieve the burden of GC for some Go programs (such as games). -- You r

Re: [go-nuts] Let Go also support manual memory management, a good or bad idea?

2020-11-15 Thread 'Dan Kortschak' via golang-nuts
This can already be done using C.malloc and C.free. You won't have access to map types using a Cgo allocator, but then you wouldn't if you had to allocate using built-ins either. On Sun, 2020-11-15 at 17:37 -0800, tapi...@gmail.com wrote: > For example, by adding two new built-in functions: alloc

Re: [go-nuts] How to drop old value in a channel salety

2020-11-15 Thread Kurtis Rader
On Sun, Nov 15, 2020 at 3:45 PM 陶青云 wrote: > > 在2020年11月15日星期日 UTC+8 下午12:19:07 写道: > >> On Sat, Nov 14, 2020 at 7:54 PM Robert Engels >> wrote: >> >>> I don’t think a ring buffer works. At least in a traditional ring buffer >>> the producer cannot pass the consumer - if the buffer is full the p

Re: [go-nuts] Let Go also support manual memory management, a good or bad idea?

2020-11-15 Thread Ian Lance Taylor
On Sun, Nov 15, 2020 at 5:38 PM tapi...@gmail.com wrote: > > For example, by adding two new built-in functions: alloc and free, garbage > collector will ignore the memory allocated by alloc. The memory allocated by > alloc must be freed by calling the free function manually. > > This would relie

Re: [go-nuts] How to drop old value in a channel salety

2020-11-15 Thread Robert Engels
I will argue if it is ok to drop the oldest then it is ok to drop all but the latest. You need more metrics on volume and latency requirements to know which is the proper approach. > On Nov 15, 2020, at 8:01 PM, Kurtis Rader wrote: > >  >> On Sun, Nov 15, 2020 at 3:45 PM 陶青云 wrote: > >> >

Re: [go-nuts] Is it possible that a hybrid memory management could be implemented?

2020-11-15 Thread Robert Engels
It is the same. If it can escape the allocation frame you need GC. > On Nov 15, 2020, at 7:34 PM, tapi...@gmail.com wrote: > >  > Aha, I forgot this fact. You are totally right. > > It is a bad example. A better example: is it possible to detect that some > values are always single-owner (an

Re: [go-nuts] How to drop old value in a channel salety

2020-11-15 Thread Kurtis Rader
On Sun, Nov 15, 2020 at 7:21 PM Robert Engels wrote: > I will argue if it is ok to drop the oldest then it is ok to drop all but > the latest. You need more metrics on volume and latency requirements to > know which is the proper approach. > If true your solution implies the O.P.'s question is a

Re: [go-nuts] How to drop old value in a channel salety

2020-11-15 Thread Robert Engels
If any can be dropped than clearly all are not needed. What is needed differs greatly if you have a billion events versus 10. Without more information on the system you cannot create an appropriate design. It is my guess that a simple hand off queue will suffice in this case. (Otherwise you nee

Re: [go-nuts] How to drop old value in a channel salety

2020-11-15 Thread Aleksey Tulinov
If you're looking for efficiency, try to sync on a single mutex. The best kind of syncing is the one that didn't happen, depending on your circumstances, pthreads mutex can beat channels even taking into account context switching because syncing on channel isn't free either. Implementing thread-sa