Re: [go-nuts] Any interest in nat.mulRange simplification/optimization?

2024-01-08 Thread Bakul Shah
For that you may wish to explore Peter Luschny's "prime swing" factorial algorithm and variations! https://oeis.org/A000142/a000142.pdf And implementations in various languages including go: https://github.com/PeterLuschny/Fast-Factorial-Functions > On Jan 8, 2024, at 9:22 PM, Rob Pike wrote:

Re: [go-nuts] Any interest in nat.mulRange simplification/optimization?

2024-01-08 Thread Rob Pike
Here's an example where it's the bottleneck: ivy factorial !1e7 1.20242340052e+65657059 )cpu 1m10s (1m10s user, 167.330ms sys) -rob On Tue, Jan 9, 2024 at 2:21 PM Bakul Shah wrote: > Perhaps you were thinking of this? > > At iteration number k, the value xk contains O(klog(k)) digits, thus

Re: [go-nuts] Any interest in nat.mulRange simplification/optimization?

2024-01-08 Thread Bakul Shah
Perhaps you were thinking of this? At iteration number k, the value xk contains O(klog(k)) digits, thus the computation of xk+1 = kxk has cost O(klog(k)). Finally, the total cost with this basic approach is O(2log(2)+¼+n log(n)) = O(n2log(n)). A better approach is the binary splitting : it just

[go-nuts] Re: Blog Article: Go Generics (and also mocking)

2024-01-08 Thread Corin Lawson
On Tuesday 9 January 2024 at 3:33:42 am UTC+11 Mike Schinkel wrote: It doesn't have to be imaginative nor obfuscated to be cognizant of naming conflicts. Thanks, you've convinced me that it needs to change so I'll do it now and I might steal that name (vermock)! On Tuesday 9 January 2024 a

Re: [go-nuts] Any interest in nat.mulRange simplification/optimization?

2024-01-08 Thread Robert Griesemer
The overflow fix is pending: CL 554617 I filed https://github.com/golang/go/issues/65027 for a possibly faster mulRange implementation. - gri On Mon, Jan 8, 2024 at 11:47 AM Robert Griesemer wrote: > Hello John; > > Thanks for your interest in this code. > > In a (long past) implementation of th

Re: [go-nuts] Any interest in nat.mulRange simplification/optimization?

2024-01-08 Thread Robert Griesemer
Hello John; Thanks for your interest in this code. In a (long past) implementation of the factorial function, I noticed that computing a * (a+1) * (a+2) * ... (b-1) * b was much faster when computed in a recursive fashion than when computed iteratively: the reason (I believed) was that the iterat

[go-nuts] Re: Creating a shared C library out of go project to be loaded dynamically by other applications (C/Perl/Python) on AIX 7.2

2024-01-08 Thread Anshuman Mor
Hi Miecc, Did you get this working, I am having exact same issues, wondering if you ever able to get this through? Or using gccgo? I am using gcc11 for this. On Thursday 24 March 2022 at 02:31:28 UTC+5:30 miecc kn wrote: > Hello everyone, first time here so please bear with me. > I got the t

[go-nuts] Re: Blog Article: Go Generics (and also mocking)

2024-01-08 Thread Mike Schinkel
On Sunday, January 7, 2024 at 9:39:31 PM UTC-5 Corin Lawson wrote: *also thoughts on the mock lib (apologies for the lack of naming creativity),* On Monday, January 8, 2024 at 9:00:24 AM UTC-5 TheDiveO wrote: *As for the naming: kudos for naming it what it is, clear and concise* A different

Re: [go-nuts] Incorrect "missing return" error for an edge case

2024-01-08 Thread burak serdar
Thank you both. I should've looked at the spec first. On Sun, Jan 7, 2024 at 10:34 PM 'Dan Kortschak' via golang-nuts wrote: > > On Mon, 2024-01-08 at 06:21 +0100, 'Axel Wagner' via golang-nuts wrote: > > The "missing return" error is defined in the spec, by requiring a > > function to end in a t

[go-nuts] Re: Blog Article: Go Generics (and also mocking)

2024-01-08 Thread 'TheDiveO' via golang-nuts
a quick first lock looks promising to me: I like the blog post, as it does IMHO a gentle introduction to your angle of attack. Having used mocking (or one of its twins/cousins/... for those who insist on this not being mocking, alas) on Python I've up to now found the Go mock packages to be d

[go-nuts] Re: CGO unpinned Go pointer panic

2024-01-08 Thread Tamás Gulácsi
That should work. Are you sure that those ellipses (...) does not contain some other pointers? Brent Bailey a következőt írta (2024. január 8., hétfő, 3:06:35 UTC+1): > I'm trying to pass a pointer to an external C library using Go 1.21 and > get the following runtime panic: > panic: runtime er