Skip to main content

Timeline for Quick QuickSort implementation

Current License: CC BY-SA 4.0

12 events
when toggle format what by license comment
Jan 12, 2020 at 15:13 comment added Anton Antonov @Karolis "Without this trick Mathematica is painfully slow" -- that is "a trick" that comes from the inherent properties of Mathematica's language. It can be seen as a manifestation of its core design principles. (Rule-based programming.) Other languages do not allow so readily dynamic increments of function definitions.
Jun 27, 2018 at 9:03 comment added Henrik Schumacher Also the matmul example in the Julia benchmarks is complete bogos. Total[Unitize[A.ConjugateTranspose[A] - 200], 2] == 0 performs the task in a tenth of time. Benchmarking matrix multiplication is ridiculous anyways as any reasonable language would delegate that to BLAS routines. The mandel implementation is not Listable. Using Compile with options CompilationTarget -> "C", RuntimeAttributes -> {Listable}, RuntimeOptions -> "Speed" would make it 10(!) times faster, bringing us much closer to the C performance.
Jun 27, 2018 at 8:15 vote accept Karolis
Jun 27, 2018 at 6:32 history tweeted twitter.com/StackMma/status/1011859708267900929
Jun 26, 2018 at 20:23 history edited Henrik Schumacher
edited tags
Jun 26, 2018 at 20:20 comment added Karolis @MarcoB I see your point. Without this trick Mathematica is painfully slow
Jun 26, 2018 at 20:11 answer added Henrik Schumacher timeline score: 18
Jun 26, 2018 at 19:35 comment added MarcoB Karolis, The memoization that @halirutan mentioned is the recFib[n_] := recFib[n] = ... bit in the linked code. You are saving the results of previous calls to recFib. Wrapping the code in a Module does not change that. Try and calculate recFib[30] with and without the ... recFib[n] = ... bit in the definition, and you will see what a tremendous difference that makes.
Jun 26, 2018 at 16:26 comment added Karolis @halirutan I put the function into Module[], which should not allow any memorisation. Commit is here. Any thoughts?
Jun 26, 2018 at 16:18 comment added halirutan For the recursive_fibonacci, I assume you use memoization and this is not what the Julia-team wanted to measure with this test. This test is supposed to measure the timing of recursive calls which are horribly slow in Mathematica. I've been there myself when I saw the testing code and asked, who on earth would implement fib like that. As it turns out, for their purpose it is the right way to do it.
Jun 26, 2018 at 16:13 comment added MarcoB I would hardly expect any top-level interpreted code to compete with a highly optimized low-level implementation (i.e. the built in), especially if you don't want to compile it. I understand your interest in doing that for recreational / educational purposes though. What strategies have you tried / would you like to implement to speed that up?
Jun 26, 2018 at 14:52 history asked Karolis CC BY-SA 4.0