Questions tagged [timing]

This Tag is used for two things: Questions regarding improving execution speed and questions where various methods are compared for execution speed.

2
votes
2answers
62 views

Interpolation works slowly

Consider the following code: ...
0
votes
0answers
61 views

How to make the following integral evaluating faster?

Consider an integral: ...
1
vote
1answer
38 views

Why do I keep getting the same time from the Timing function?

I am running a gamblers problem solution where I am testing the timing involved in solving the Ax = b equation for matrices of n=100, 1000, 10000, and 100000. For some reason I keep getting the same ...
5
votes
3answers
927 views

How to speed up a process

I am wondering how to speed up the following code: Currently it takes more than two sec to be processed. ...
1
vote
2answers
58 views

Reduce Plot3D evaluation time?

I have a large function func[a,b] and I need its Plot3D. Since the command ...
15
votes
1answer
562 views

List generation speed change at ~800 iterations

I recently have been developing a project for my students to explore some functionality of the Wolfram Language and have requested that they investigate the timing for several different methods of ...
13
votes
3answers
251 views

How do I get the timing of an evaluation after it has already finished?

Sometimes I forget to add Timing[] to my evaluation and only notice it once it has already finished. Some of my calculations take hours or even days, so I don't ...
0
votes
1answer
214 views

How can I decrease timing to find measure of edges of a tetrahedron?

Let be $ABCD$ is a tetrahedron, knowing that $ABC$ is an equilateral triangle $AB=a$, $AD=d$, $BD=e$, $CD=f$. I want to find the $a$, $d$, $e$, $f$ when the angle of two vectors $AB$ and $CD$ equal to ...
0
votes
1answer
43 views

How to show Timing command with more decimals?

I'm trying to compare the time that it takes to use the command LinearSolve when solving matrix(with random integers from 3 to 150 in each position) that are 10x10,20x20,30x30, ... , 150x150 for the ...
3
votes
1answer
91 views

Is there any way to use Timing without the result of the operation being shown? [closed]

I'm trying to analyze the difference of time when using LinearSolve with different matrix. The problem is that in some cases I'm using 150x150 matrix so the result uses A LOT of space. Is there any ...
1
vote
1answer
94 views

Three seconds to take the 1st element of list?

I'm working with FashionMNIST, a small (70k) list of rules containing 28x28 images. I don't understand the slow-down in the example below. No matter the size of the list, simple operations like taking ...
4
votes
1answer
59 views

Very Slow Accumulate of random time segments

Even for short list (15 elem) of random time segments of DateObjects, Accumulate consumes unexpectedly long times. But, when time segments are not random, or are ...
4
votes
1answer
65 views

Slow Indefinite Integral

This might have been asked before but I couldn't find the answer. I want to perform an indefinite integral. I tried it both on Mathematica and Maple and the commutation time is significantly different....
0
votes
0answers
45 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 ...
4
votes
1answer
146 views

Runtime Errors calling function myTiming taken from Shifrin's book

I am using Mathematica 11. Recently I was reading Mathematica® programming: an advanced introduction, and found a function called myTiming. It differs from build-in ...
0
votes
0answers
52 views

Calculation time for a limit, is my calculation still calculating?

I am calculating the limit of an eighth order derivative with ~700 terms. The notebook has been in the 'running' phase for a few days now. If it says it is still running, does this necessarily mean ...
4
votes
1answer
120 views

Speeding up ImageCorrespondingPoints

I have the following problem: I am taking free-handedly photographs from the same scene during e.g. hiking, because sometimes I don't want to lug around a tripod. The goal is e.g. to create later on ...
2
votes
1answer
181 views

Compile is slower for simple example

So I have what I assumed to be a textbook example of where compiling my code would be faster. I just make a little ellipse in the complex plane; ...
11
votes
1answer
178 views

RunProcess vs. Run - cpu usage

Bug introduced in 10.0 and persisting through 11.2 RunProcess is new in 10.0 Comparing the cpu usage of ...
0
votes
1answer
50 views

Precomputing Function with ReplaceAll[]

I have a function f that is a combination of multiple other functions g_i, which themselves are combinations of other functions <...
2
votes
1answer
92 views

Timing functions with Sow / Reap and AbsoluteTiming

I have a main function f[x] that calls three sub-functions: ...
2
votes
0answers
29 views

AbsoluteTiming gives vastly smaller results than it should

I've been having some recurrent issues with AbsoluteTiming and I would like to have a better idea of what causes them and whether they can be avoided. More ...
1
vote
0answers
45 views

plotting several functions: order influences Timing

Consider the following, fairly long, function definition (note however that it only consist of the elementary operations addition, multiplication and exponentiation): ...
3
votes
1answer
71 views

Weird problem adding up elements from matrice in list

I encountered a problem which seems very weird to me. I hope it can be understood from my description and is reproducible. I try to add up elements of a matrice to a vector (part of FEM), an example ...
0
votes
0answers
43 views

Improve timing of URLExecute command?

I am using a ionosphere model that runs online, IRI2016. The URL gives me a table with usefull parameters like electron density in upper atmosphere. The URLExecute...
3
votes
2answers
94 views

How to do calculations in a loop from list of data?

I wrote the code below to do the calculation for each variables. I would like to know how to do this in one loop and to print out timing each time a cycle of calculations is completed. Another ...
2
votes
0answers
40 views

FindShortestTour suddenly runs far slower for large numbers of points

I was doing a benchmark of FindShortestTour and I noticed something really weird. Around 10000 points, FindShortestTour suddenly takes 6 times as long without explanation: ...
5
votes
2answers
865 views

A while loop that terminates after a number of seconds elapsed?

I would like to write something along the lines of: While[(t=Timer[])<60 (*in seconds*), ...do stuff... ] Unfortunately, I'm not aware of a timer object in ...
11
votes
0answers
597 views

What algorithm is Mathematica using to find the smallest eigenvalue so quickly?

My question is what kind of black magic is Mathematica doing to obtain the correct answer so quickly compared to other programming languages? Details: I've written a Mathematica notebook to find the ...
3
votes
1answer
34 views

ListLinePlot much slower when using smaller PlotRange on y axis

Using 11.1.0 for Linux x86 (64-bit). This should be pretty self-explanatory. ...
4
votes
1answer
118 views

Fast way to compute a truncated series using Fold

I'm looking at an efficient and fast way to compute the results of a finite summation $$\sum_{i=0}^Mf_ig_i\,. $$ I noticed that simply applying ...
2
votes
1answer
119 views

How to express calculation time with ProgressIndicator

How to express calculation time with ProgressIndicator. I want to make the following CDF document. ...
25
votes
4answers
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: ...
11
votes
2answers
510 views

ParallelMap vs Map performance comparsion

The ParallelMap claims doing map faster than the normal Map, and I checked the demo does as the document describing but, I try ...
4
votes
1answer
208 views

Why is this simple Table calculation so slow

I have the following code ...
29
votes
1answer
581 views

Benchmarking: unexplained switching between high and low performance

tl;dr I am trying to accurately benchmark some vectorized operations, and compare them between systems. But benchmarking is hard to do well, and I am getting inconsistent results: performance is ...
10
votes
1answer
240 views

How to clear Integrate internal memory?

I noticed that when I call Integrate for the first time, on an integral that I know will take longer than the time limit I give it, it will abort for the first time,...
2
votes
0answers
110 views

Making code faster?

I am dealing with a very simple code, which turns to be slow when I try to plot the final Piecewise function. Is the code computing back again the integral iteratively rather than just substituting d=...
5
votes
2answers
174 views

Unexpected slowness of FindShortestTour through 9 points

This a very useful function, but it is very slow: ...
3
votes
1answer
69 views

More realistic timings for evaluations with large outputs [duplicate]

What timing method will take into account all (kernel and frontend) operations? ...
1
vote
2answers
286 views

Efficient generation of associated Legendre Polynomials

For the calculation of a high order spherical harmonics expansion model, I would need a matrix of associated Legendre Polynomials ${P}_{l}^{m}(x)$ with a constant $x$ and $\{l,m\}$ running from $\{\{2....
6
votes
0answers
116 views

Difference between Timing, AbsoluteTiming, and Elapsed?

In the picture below, Difference between Timing, AbsoluteTiming, Time and ...
4
votes
1answer
90 views

Programmatically access the data from the Parallel Kernel Status window

I want to show the parallel kernel status within a notebook, and not in the separate Parallel Kernel Status window. How can I programmatically access the Performance Measurements data shown in the ...
3
votes
0answers
89 views

How to make reading from long lists faster?

Background I am using Mathematica to solve a traveling-salesman-like problem. I implemented two different algorithms that are able to solve this type of problem and both algorithms yield the same ...
2
votes
2answers
127 views

Why is the execution time getting smaller and smaller every time?

Why is the execution time to compute the value of sum getting smaller and smaller every time in the following code? And how to get consistency? Thank you very much for your help. ...
1
vote
1answer
126 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 ...
11
votes
3answers
471 views

How to speed up plotting with PlotPoints?

I'm plotting an ellipse 1/(1 - e Cos[x]) with e=0.9 using PolarPlot. Taking $x\in[0,2\pi)$, ...
6
votes
2answers
122 views

Time elapsed for aborted computation?

I have a computation which is taking very long AbsoluteTiming[sr = ShellRegion@region]; Instead of getting $Aborted, is there a system method to get a time ...
0
votes
0answers
149 views

What is the correct way to control thread parallelism?

I was trying to benchmark a program I have writing against Mathematica (or better said the internal Kernels used, like MKL). Since my program is not threaded I wanted to compare with Mathematica 10 ...
7
votes
1answer
188 views

Is it possible to use a function for EdgeWeight in a Graph?

Why I cannot calculate all edge weights beforehand: I have many large graphs for which I'd like to find the shortest path between two vertices (FindShortestPath ...