User talk:Horst.h: Difference between revisions

m
(Sieve of Eratosthenes comments and improvements...)
 
(13 intermediate revisions by 6 users not shown)
Line 1:
==timings on RC==
Hi, I note that in one of your examples you sprinkle timings. On RC we tend not to get too involved in mentioning runtimes unless it is exceptionally slow. It is best to restrict timings to maybe comparative timings between two algorithms in the same language, and only where necessary: "This new algorithm cut the run time from X hours to only Y minutes" kind of thing. Actual run times will be hard to duplicate by anyone else, but th scaling in run times might be achieved. The RC emphasis is on idiomatic code rather than the absolute fastest code. Most examples will not take hours to run in most programming languages, and most examples don't need timings.
 
Thanks for your examples :-)<br>--[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 23:09, 12 December 2018 (UTC)
 
 
===Your Extensible Prime Generator Pascal contribution===
 
You have obviously gone to great lengths to produce a fast version of this using Free Pascal, which caused me to look up what it is and found it interesting that it is a reincarnation and modernized version of Turbo Pascal/Delphi (most of the current contributors seem to have been not more than about 10 years old when Turbo Pascal first appeared!). Although I used Turbo Pascal commercially in about 1983 and later learned Delphi, it didn't cause me to want to abandon my current stable of more modern languages to take Pascal up again. But your taste seems to differ.
Line 22 ⟶ 24:
 
BTW, a good way to make speeds more comparable in a CPU agnostic way is to post them as CPU clock cycles per cull operation and CPU clock cycles per prime found - that removes much of the variation between comparisons that people using your examples would have although for some algorithms on some CPU's there is some variation be up to a factor of two due to the abilities of the CPU such as simultaneous micro instruction execution (not including hyper-threading or multi-threading).--[[User:GordonBGood|GordonBGood]] ([[User talk:GordonBGood|talk]]) 08:06, 6 January 2019 (UTC)
 
: I think that it may be possible to write a Free Pascal version of the Sieve of Eratosthenes that catches up to Kim Walisch's primesieve with the current fpc compiler:
 
: I run a very simple Sieve of Eratosthenes benchmark that tests raw maximally optimized (other than extreme loop unrolling as used in primesieve) loop speed; this implementation is run over only a 16 Kilobyte buffer of packed bits representing odds-only numbers as every modern CPU will have a L1 cache of at least that big, thus, it sieves for the primes up to 262146 with the answer 23000 (including the known only even prime of two).
 
: On Wandbox with full optimization, [https://wandbox.org/permlink/2rhmyx0j1VbeMzPY a Free Pascal version using the HEAD version 3.3.1 compiler] takes only about 156 milliseoonds, there [https://wandbox.org/permlink/9Ezpc6epuL9ZbDaz a C version using Clang HEAD version 8.0.0] takes about 147 milliseconds where the difference is probably just "line noise" but it also may be that Free Pascal still doesn't fully tune the order of likely the same machine instructions used. The Free Pascal compiler has been greatly improved since the last release as it takes about 250 milliseconds with the last version 3.0.2: I expect that it now combines the bit modification "k^ := k^ or msk;" into a single read modify write instruction rather than the former one instruction to read from memory, another to modify, and another to write the result back to memory. This last is what Google's Go language still does, which is one of the reasons it is fairly slow for this benchmark.
 
: A maximally optimized Sieve of Eratosthenes must use bit packing to make maximum use of the CPU caches, and (when optimized such as here), the cost of any extra operations to do with bit-packing is more than made up for in improved memory access times using the L1 cache. As Pascal has pointers as used here and with the newly optimized compiler, it should be able to take advantage of extreme loop unrolling as used by primesieve to gain a little more, especially for smaller base primes.
 
: It's been a "blast from the past" for me to re-visit Pascal after all these years in order to write this benchmark, but it has also made me realize how far language design has moved on since Turbo Pascal days when we used to rave about it: when compared to a modern language like Kotlin, or Nim, or with modern functional languages like Haskell or even more F#, there is just no going back for me as it feels "clunky". Verbosity in declaring var's separately from the code using them, no type inference whatsoever, begin/end blocks, etc. etc. Even Julia is better, although I don't like dynamic typing there are ways to get around it with some effort.--[[User:GordonBGood|GordonBGood]] ([[User talk:GordonBGood|talk]]) 04:43, 8 January 2019 (UTC)
 
 
==27s==
Thanks/wow --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 12:45, 26 June 2019 (UTC)
 
 
==signing the adding of text in discussions==
When adding (your) text to topics on discussion pages, please sign (appended at the end of your additions) with:
<br>
:::: <big><big><big> <nowiki> -- ~~~~ </nowiki> </big></big></big>
 
That is, two minus signs (or whatever), with four tildes (<b>~</b>). &nbsp; &nbsp; The latter adds your ID (name), and the UTC date and time. &nbsp; &nbsp; (There are other formats you can use.)
 
It saves (for all others) the bother of looking up who did what in the &nbsp; ''history'' &nbsp; page. &nbsp; &nbsp; -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 22:08, 15 August 2019 (UTC)
 
 
==Brazilian numbers speed up==
Thanks for your hints on speeding up the calculations of Brazilian numbers.
 
Because I looked up the history incorrectly, I attributed the hint to the wrong person. &nbsp; &nbsp; -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 22:08, 15 August 2019 (UTC)
 
== n-smooth numbers ==
Your &nbsp; Pascal &nbsp; entry for the &nbsp; '''n-smooth numbers''' &nbsp; concerning the 2nd part of the task, &nbsp; the output is missing for &nbsp; '''3-smooth''' &nbsp; and &nbsp; '''5-smooth''' &nbsp; numbers. &nbsp; &nbsp; -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 18:43, 30 August 2019 (UTC)
 
==Cut Python in Super-d numbers?==
Hi, you seem to have cut the Python entry? --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 09:52, 24 November 2019 (UTC)
: Python and Pascal restored.--[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 10:04, 24 November 2019 (UTC)
::I used the link of RSS-feed and edited that site.Maybe so the Python entry get lost and Perl, next to Pascal, survived.Next times I will use the reloaded original page --[[User:Horst.h|Horst.h]] ([[User talk:Horst.h|talk]]) 10:00, 25 November 2019 (UTC)
 
::: Thanks. --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 18:01, 25 November 2019 (UTC)
 
== First power of 2 that has leading decimal digits of 12 ==
 
To (re-)use an old saying, "now you're cooking with gas!". &nbsp; Quite a speed-up, eh? &nbsp; &nbsp; -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 19:58, 15 January 2020 (UTC)
 
: Thanks. I was horrified by the thought, to use base conversion on such big numbers. --[User:Horst.h][[User:Horst.h|Horst.h]] ([[User talk:Horst.h|talk]]) 20:17, 15 January 2020 (UTC)
 
:: Don't feel bad, I went down the same road, but much slower. &nbsp; When I realized that I couldn't compute (express) the (last example) power of two on my PeeCee, I had to re-invent the program. &nbsp; &nbsp; -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 20:22, 15 January 2020 (UTC)
 
::: Many thanks for the pointer on how best to do this :)
 
::: I was going down a complete blind alley before! --[[User:PureFox|PureFox]] ([[User talk:PureFox|talk]]) 21:09, 15 January 2020 (UTC)
 
== Edit mishap? ==
Is this supposed to mean something or should (most of) it just be deleted?
https://rosettacode.org/mw/index.php?title=Talk:Minimum_positive_multiple_in_base_10_using_only_0_and_1&diff=prev&oldid=298071
--[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 13:39, 4 March 2020 (UTC)
:mishap! Sometimes my fingers are out of CRTL-V
Anonymous user