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.

Filter by
Sorted by
Tagged with
3 votes
2 answers
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 ...
user avatar
  • 1,393
5 votes
1 answer
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 ...
user avatar
3 votes
1 answer
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 ...
user avatar
  • 311
1 vote
1 answer
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 ...
user avatar
  • 199
0 votes
0 answers
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 ...
user avatar
  • 789
1 vote
1 answer
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, ...
user avatar
0 votes
3 answers
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 ...
user avatar
  • 21
1 vote
1 answer
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 ...
user avatar
3 votes
4 answers
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 (...
user avatar
  • 215
1 vote
2 answers
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}$, ...
user avatar
  • 3,542
6 votes
4 answers
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 ...
user avatar
  • 2,638
0 votes
0 answers
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 ...
user avatar
  • 3,542
3 votes
1 answer
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....
user avatar
0 votes
0 answers
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 ...
user avatar
  • 97
1 vote
0 answers
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 ...
user avatar
  • 641
3 votes
0 answers
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 ...
user avatar
4 votes
1 answer
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 ...
user avatar
  • 902
3 votes
2 answers
121 views

NIntegrate timing discrepancy

When I run the following identical numerical integrals ...
user avatar
  • 755
4 votes
0 answers
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 ...
user avatar
0 votes
1 answer
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: ...
user avatar
  • 127
4 votes
1 answer
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 ...
user avatar
  • 641
7 votes
1 answer
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 ...
user avatar
  • 1,153
2 votes
0 answers
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:...
user avatar
1 vote
1 answer
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, ...
user avatar
  • 14.8k
1 vote
0 answers
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 ...
user avatar
2 votes
2 answers
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 ...
user avatar
  • 83
0 votes
0 answers
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 ...
user avatar
  • 101
2 votes
1 answer
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? ...
user avatar
  • 1,723
1 vote
1 answer
84 views

Generalization of code is slower than particular case

I wrote the following Mathematica module: ...
user avatar
  • 153
2 votes
3 answers
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... ...
user avatar
  • 9,055
9 votes
1 answer
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 <...
user avatar
3 votes
2 answers
220 views

Interpolation works slowly

Consider the following code: ...
user avatar
  • 3,542
1 vote
1 answer
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 ...
user avatar
  • 247
5 votes
3 answers
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. ...
user avatar
1 vote
2 answers
158 views

Reduce Plot3D evaluation time?

I have a large function func[a,b] and I need its Plot3D. Since the command ...
user avatar
  • 25
15 votes
1 answer
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 ...
user avatar
  • 1,043
19 votes
3 answers
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 ...
user avatar
  • 763
0 votes
1 answer
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 ...
user avatar
0 votes
1 answer
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 ...
user avatar
3 votes
1 answer
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 ...
user avatar
1 vote
1 answer
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 ...
user avatar
  • 30.3k
4 votes
1 answer
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 ...
user avatar
  • 900
4 votes
1 answer
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....
user avatar
  • 297
0 votes
0 answers
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 ...
user avatar
4 votes
1 answer
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 ...
user avatar
0 votes
0 answers
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 ...
user avatar
4 votes
1 answer
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 ...
user avatar
  • 1,245
2 votes
1 answer
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; ...
user avatar
  • 1,259
11 votes
1 answer
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 ...
user avatar
  • 517
0 votes
1 answer
96 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 <...
user avatar
  • 295