# 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.

125 questions
Filter by
Sorted by
Tagged with
69 views

### Format Time Reported by AbsoluteTiming

I am trying to format the timing reported by AbsoluteTiming so that it states the hours minutes and seconds of the result. However, probably because ...
• 1,393
93 views

### Why the coefficient function is very fast

When looking for the coefficients of an desired series, I found that the Coefficient function is very fast compared to other functions and methods. In the following summary, we find the different ...
65 views

### Defined function takes more time than pure/anonymous function. Why? [duplicate]

A function defined by f[x_]:=<code> and applied on every element of a list as f /@ testList seems to take longer than the ...
• 311
1 vote
134 views

### Explicit integration of PDE running very slowly

I would like to solve the PDE $\frac{\partial u}{\partial t}=(1-x)\frac{\partial u}{\partial x}$, in the interval $[0,1]$, with initial condition $u(0,x)=e^{-218(\frac{-2}{3}-ln(1-x))^2}$, by manually ...
• 199
51 views

### Why is Clip so slow and how can I improve its performance?

The built-in function Clip is defined as a way to clip a value between a specified minimum and maximum. Another way to do this, is simply by utilizing ...
• 789
1 vote
40 views

### How to get correct note timings when importing multi-track Midi files?

I have observed when importing midi files with more than one track, the times for every track except for the first one are sped up. for example, ...
• 878
109 views

### Elimination of the variables

I am trying to get an equation in terms of variable z by eliminating variables g0 and g1 but Running below code is taking time forever ...
• 21
1 vote
62 views

### Using With[] vs. Using a Pure Function for Constants

There are many cases where I am conflicted over using With[] versus using pure functions when dealing with constants, knowing the output is the same either way. For ...
• 1,547
219 views

### Code to solve quadratically constrained quadratic optimisation problem using FindMinimum is very slow. How do I make it faster?

The problem I have a quadratically constrained quadratic optimisation problem (QCQP) which takes about 13 seconds to find the optimal solution. I want to iteratively optimise a large number of times (...
• 215
1 vote
128 views

### How to make the following code work faster?

The problem I would like to compute the Lorentz transformation $\mathbf{p}'$ of an arbitrary 3-momentum vector $\mathbf{p}$ given a boost characterized by some other momentum vector $\mathbf{p}_{N}$, ...
• 3,542
135 views

### Check if list is singleton in sub linear time

A singleton is a list whose elements are equal. Some ways of checking this in Mathematica: {Equal@@#&, 1==Length@Union@#&, MatchQ[#,{x_ ..}]&} I ...
• 2,638
63 views

### How to evaluate the following integral faster?

I have a problem with the time required for evaluating the multi-dimensional integral and would be grateful for any help in reducing this time. First of all, there are some pre-definitions used in the ...
• 3,542
145 views

### Why Dot product of my vectors takes longer than usual?

I have a list containing 100 complex numbers lying between 1.9 + 1.9 i and 2.0 + 2.0 i you can download its mx file from the link below and import it in Mathematica: http://adambarfib.ir1.rapidpars....
50 views

### Long execution time using position

I have two lists, for example: List1={2,4,6,8,10,12} List2={4,10,12} I want to find the positions in List1 such that the element at that position is equal to the ...
• 97
1 vote
43 views

### How to reduce the computation time of this series expansion?

I have a complicated function gg[Delta,l][z1,z2] which is given in the sample code below. I would like to expand this function for as many ...
• 641
52 views

### Why is doing a computation inside Select slower than a precomputation?

I am trying to generate primitive Pythogorean triples using Euclid's parametrization. I basically want a list of pairs with ordered pairs $(m,n)$ such that $m$ and $n$ are coprime. My first approach ...
• 161
100 views

### Multi-dimensional array lookup vs flat array lookup with compute

During Monte-Carlo (MC) simulations on a latice of dimensions $(L_1,L_2,\ldots,L_D)$, all the site varibales are often stored as a $D$ dimensional array array. To ...
• 902
121 views

### NIntegrate timing discrepancy

When I run the following identical numerical integrals ...
• 755
41 views

### Difference in computation speed of Eigensystem not to expectation for ParallelTable and Table

I was trying to compute the time it takes for Eigensystem to evaluate while being inside a ParallelTable, as it is well-known LAPACK subroutine has an inbuilt Parallelization to it. And the difference ...
25 views

### Calculation time differs between segmented loops and one whole loop

I stumbled on a strange issue while simulating a large number of random values, $10^8$ to be precise. I generated the numbers at first by the following code: ...
• 127
189 views

### Reduce the time of computation for $5$-dimensional numerical integration

I need to perform (numerically) the $5$-dimensional integral given in the code below for a large number of values of $\epsilon$. The code I have at the moment takes $\sim 11$ minutes and returns an ...
• 641
584 views

### Mathematica 12.1 start-up time in Linux extremely slow

I installed Mathematica 12.1 on my Linux machine and the start-up time is extremely slow. I see the Spikey logo and messages like: Initializing Kernel connections ...
• 1,153
31 views

### Summing Kronecker Deltas: Sharp slowdowns for simple sums

I'm using Mathematica 12.0 Student Edition. I'm a little confused by the length of time Mathematica takes to evaluate certain sums of Kronecker Deltas or Discrete Deltas. Here's a simple example below:...
• 135
1 vote
58 views

### Converting Timing to TimeObject

What's the proper way to get Timing and post-process it for example to convert to a TimeObject as a defined function? In line, ...
• 14.8k
1 vote
62 views

### Filtering Fibonacci numbers for elements meeting certain criteria [closed]

Write a code that selects in less than two seconds from every 123rd of the first 33,333 even Fibonaci numbers; those which contain the digits 2, 3, 6, 7, and 8 and also contains the digit 1 more than ...
• 11
147 views

### How to set a timer (countdown) in Manipulate what stops it running?

I have a Manipulate function with 2d slider which I can play with some curves. I consider this as a game (gamification in physics). I want to set a timer so when it countdown to zero then the game ...
• 83
92 views

### How to speed up Timing[4^(10^10)]

I have an old computer with a quad-core AMD Phenom II processor (3Ghz). When I run Timing[4^(10^10)]the computer takes hours to evaluate the expression. I'm not ...
• 101
171 views

### Using Parallelize in a solve function

Is there a way to use Parallelize the following operation, in order to make it do the calculations faster? Or is there another way to speed up this calculation? ...
• 1,723
1 vote
84 views

### Generalization of code is slower than particular case

I wrote the following Mathematica module: ...
• 153
99 views

### Summing all the times of a column

It is possible to add a last row in the table where I can show the sum of values of the last column. I would like to get the total time value... ...
• 9,055
451 views

### Show timing of every output

I know I can follow Wolfram's guide and enable "ShowTiming" to show the timing of the previous command at the bottom of the window. Additionally, I can enable <...
• 641
220 views

### Interpolation works slowly

Consider the following code: ...
• 3,542
1 vote
55 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 ...
• 247
1k 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
158 views

### Reduce Plot3D evaluation time?

I have a large function func[a,b] and I need its Plot3D. Since the command ...
• 25
565 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 ...
• 1,043
923 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 ...
• 763
244 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 ...
• 1,801
101 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 ...
125 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
102 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 ...
• 30.3k
71 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 ...
• 900
84 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....
• 297
49 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 ...
166 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 ...
128 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 ...
159 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 ...
• 1,245
206 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; ...
• 1,259
259 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 ...
• 517