Linked Questions

0 votes
0 answers
51 views

What could cause Timing to report erroneously? [duplicate]

I am using Timing to measure the time it takes to load a ".dat" file and the reported time (4.47 seconds) is waaaay below the real time (measured using a stopwatch ...
Benjamin Márkus's user avatar
56 votes
1 answer
5k views

Why won't Parallelize speed up my code?

What reasons are there that can cause parallelized Mathematica code not to run with full performance?
Szabolcs's user avatar
  • 233k
25 votes
2 answers
11k views

Measuring execution time of code

How one can measure the execution time (time that is spent for code to finish) of a program in Mathematica? I understand that there are general timing functions (Timing, AbsoluteTiming, TimeUsed, etc....
sky-light's user avatar
  • 817
25 votes
4 answers
1k views

Throwaway memoization makes built-ins faster?

Yesterday I got into an argument with @UnchartedWorks over in the comment thread here. At first glance, he posted a duplicate of Marius' answer, but with some unnecessary memoization: ...
LLlAMnYP's user avatar
  • 11.4k
18 votes
3 answers
636 views

Difference between HashTable datastructure and Association datastructure

Is there a difference in the runtimes between CreateDataStructure["HashTable"] and <||> in terms of inserting, ...
Lucas Mumbo's user avatar
8 votes
6 answers
464 views

Deleting duplicates of a list without touching specified elemets

Suppose I have a list, for example: list = {1, 3, 5, 5, 12, 12, 6, 11, 7, 7, 9, 10, 2, 2, 4}; and list of duplicates positions in the list ...
David Baghdasaryan's user avatar
20 votes
2 answers
723 views

Incorrect Timing of Total

For demonstrating how fast C-compiled functions can be, in one of my courses I use the following function for finding the sum of a list of reals: ...
Fred Simons's user avatar
  • 10.1k
5 votes
3 answers
1k views

Incresing efficiency of the code:

I have a set of points, representing location of events in a map, and I want to find the closest neighbour for each point. Variable xys is a 2D matrix containing ...
Sange's user avatar
  • 325
7 votes
2 answers
291 views

How to select the fastest approach for large numerical data computations?

I really love the flexibility of Mathematica: there are several ways to perform one task. However, to get the performance of the intense numeric calculation, it can ...
Nam Nguyen's user avatar
  • 1,751
18 votes
1 answer
281 views

Why Function is not identical to `&` in autocompilation?

Here is the example, copied from here square = Function[x, x^2]; square1 = #^2 &; the timing and unpacking status shows ...
matheorem's user avatar
  • 16.9k
1 vote
3 answers
457 views

Fastest way to find roots

I'm working with generative polynomials, and would like to know if there is a faster way to calculate roots. Using the technique below I've managed to cut the time down significantly. However at n=35, ...
Daniel's user avatar
  • 71
3 votes
2 answers
128 views

NIntegrate timing discrepancy

When I run the following identical numerical integrals ...
Chris's user avatar
  • 983
2 votes
1 answer
119 views

Why the "Sum" function becomes extremely slow at a specific size of matrix? How to AVOID it? [duplicate]

Three methods("Sum", "Total@Table" and "Do") have been used to do the same work. The "Sum" and "Total@Table" function becomes extremely slow at num=...
SongSun's user avatar
  • 97
1 vote
1 answer
238 views

Why, according to Timing, is this code so FAST?

Obviously (?) I have a problem with precision or something but MMA seems to be able to take the mean squared of a 1e7 long series of random reals in literally no time, unless I use RepeatedTiming ...
Julian Moore's user avatar
  • 2,560
6 votes
0 answers
214 views

Difference between Timing, AbsoluteTiming, and Elapsed?

In the picture below, Difference between Timing, AbsoluteTiming, Time and ...
Hoony's user avatar
  • 1,459

15 30 50 per page