Jump to content

Talk:Rare numbers: Difference between revisions

→‎Tweaks, Go: Responded to Enter your username.
m (→‎Tweaks, Go: response to inquiry)
(→‎Tweaks, Go: Responded to Enter your username.)
Line 482:
 
:: The original version of your 2nd Go program runs about 2-3 seconds slower than the version I put at the Tio.run link. So these tweaks are not much of an improvement. Thanks so much for sharing your version. Not sure why it would go slower on your core i7. I just installed Go for the first time at v 1.13.1. I am careful to keep any other programs from executing concurrently that might interfere with the timing measurements. The full name of my cpu is i7-7700 @ 3.6Ghz. Operating on Win10. It is not overclocked, I have not verified it's speed with any benchmarking software. --[[User:Enter your username|Enter your username]] ([[User talk:Enter your username|talk]]) 04:34, 30 September 2019 (UTC)
 
::: Mine's an Intel 8565U which has a much lower base frequency (1.8 GHz) but a higher turbo frequency (4.6 GHz) than yours (4.2 GHz I believe). I suspect yours will be faster overall but there's probably not a great deal in it.
 
:::Incidentally, I'm using Ubuntu 18.04 rather than Windows 10 but I've no reason to suppose that Go executes faster on one rather than the other nowadays.
 
:::Anyway, the good news is that I've come up with a new strategy which is significantly faster - 15 digits is processed in around 28 seconds compared to 42 seconds previously.
 
:::Basically, I'm using a combination of Nigel and Shyam's approachs which cuts down the Cartesian products quite a lot but, unfortunately, still not enough to process 16 digits before running out of memory.
 
:::To deal with the memory problem, I've added a second version which delivers the Cartesian products 100 at a time rather than en masse. Not surprisingly, the former is slower than the latter and it's back up to about 43 seconds to get to 15 digits. However, 16 digits takes less than 4 minutes and 17 digits less than 12 minutes - I couldn't be bothered to go any further than that - so it's a worthwhile trade-off.
 
:::The idiomatic way to 'yield' values in Go is to spawn a goroutine and pass it a channel (or a buffered channel in this case). However, I'd stress here that I'm not trying to parallelize the algorithm (although one certainly could) as I don't like doing this for RC tasks. --[[User:PureFox|PureFox]] ([[User talk:PureFox|talk]]) 15:14, 30 September 2019 (UTC)
9,490

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.