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
1 vote
1 answer
67 views

Creating and printing a real-time evaluation timer

I want to print a timer that starts at 0 when an evaluation begins and stops when the evaluation is completed. I have come up with the following solution using Clock...
oakley09's user avatar
2 votes
1 answer
56 views

CPU time in iteration process

Let $Tx=\frac{x}{2}$ for all $x\in[0,1]$. Let $x_{0}\in[0,1]$ and set an iterative sequence $\{x_{n}\}$ by the method $x_{n+1}=Tx_{n}$. Now if $x_{0}=0.8$, then I get a convergent sequence towards the ...
Junaid Ahmad's user avatar
3 votes
2 answers
126 views

Position command runs much slower for range containing numerically evaluated Bessel function

I have a long list (about 10000) of positive numbers (here simply denoted list), for which I want to find the positions of elements lying between 0.5 and the first ...
Chris's user avatar
  • 983
13 votes
3 answers
467 views

Why does Module slow down StringMatchQ by 180 times?

I knew that Module is slower than With or Block, often by several times. But it surprises me ...
Lacia's user avatar
  • 2,183
3 votes
1 answer
49 views

Inconsistent Timing on FinancialBond valuations

I need to do bond valuations (lots of them across lots of data) using FinancialBond. Context & Background I have daily interest rate data on 30 year US Treasury ...
Jagra's user avatar
  • 14.3k
1 vote
1 answer
117 views

How do I speed up this numerical integration with Bessel functions? (Tried changing Working Precision and Integration Strategies)

I need to compute the function P[b] given as follows: ...
Dave's user avatar
  • 11
0 votes
0 answers
41 views

Derive a function and then make a fast version for execution

I would like to derive a (complicated) equation of motion and integrate it efficiently numerically. I can do this "by hand" by copying the resulting function in a new function and then ...
John Bechhoefer's user avatar
0 votes
1 answer
147 views

Inverse taking no time? [closed]

I was comparing the time that the computer takes to perform Partial Pivoting, Total Pivoting and multiplying by the inverse. The code (that makes the comparison chart) is as follows: ...
Pedro García's user avatar
0 votes
0 answers
93 views

Solving an equation without output

Could you please help in solving the equation below. I am not able to do it with the current version of mathematica (very old one). All parameters are real and positive. Thank you so much in advance <...
ridha's user avatar
  • 21
1 vote
0 answers
65 views

Is there any hope to compute the determinant of $56\times 56$ parametric matrix and simplify the result?

I have this $56\times 56$ parametric matrix $M$ and I want to compute its determinant where $\{t,y,z\}$ are some real parameters. I use Det[M] but it takes a lot ...
charmin's user avatar
  • 1,159
6 votes
1 answer
183 views

Why does Table take so much longer than its constituent computations?

I have a 10x5xn list, which I'll call data, data = RandomInteger[{-500, 500}, {10, 5, n}]; ...
az123p's user avatar
  • 239
9 votes
2 answers
355 views

Speeding up time in computations: a visual and easy way to find the slowest parts of a code

Edit: I searched the wolfram function repository and there is a nice function EvaluationTiming by a Wolfram Research member that makes a dataset from the timing data of a computation. If we set ...
userrandrand's user avatar
  • 5,637
0 votes
1 answer
73 views

Why the performance of list of Timings depend on the order?

It seems that the result of list of Timings and AbsoluteTimings depends on the order, while ...
Lacia's user avatar
  • 2,183
4 votes
1 answer
44 views

Timing Discontinuity with Replace[] Function

When constructing certain square matrices I noticed a sharp jump in the time required to build them. I've included code and a plot of time required to make the matrix vs dimensionality of the matrix. ...
Ken Robbins's user avatar
4 votes
2 answers
85 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 ...
Nicholas G's user avatar
  • 1,951
5 votes
1 answer
107 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 ...
Tag Mohamed Amine's user avatar
3 votes
1 answer
72 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 ...
Ondrej Draganov's user avatar
1 vote
1 answer
142 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 ...
JBuck's user avatar
  • 199
0 votes
0 answers
67 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 ...
polfosol's user avatar
  • 930
1 vote
1 answer
57 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, ...
Alec Graves's user avatar
-1 votes
3 answers
146 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 ...
Tiku's user avatar
  • 51
1 vote
1 answer
77 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 ...
Just Some Old Man's user avatar
3 votes
4 answers
267 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 (...
ModCon's user avatar
  • 225
1 vote
2 answers
136 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}$, ...
John Taylor's user avatar
  • 4,984
6 votes
4 answers
157 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 ...
Adam's user avatar
  • 3,797
0 votes
0 answers
65 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 ...
John Taylor's user avatar
  • 4,984
3 votes
1 answer
159 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....
Mostafa Saber's user avatar
0 votes
0 answers
54 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 ...
Orion's user avatar
  • 97
1 vote
0 answers
58 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 ...
Pxx's user avatar
  • 681
3 votes
0 answers
53 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 ...
Fixed Point's user avatar
4 votes
1 answer
159 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 ...
lineage's user avatar
  • 1,114
3 votes
2 answers
128 views

NIntegrate timing discrepancy

When I run the following identical numerical integrals ...
Chris's user avatar
  • 983
4 votes
0 answers
50 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 ...
Roopayan Ghosh's user avatar
0 votes
1 answer
26 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: ...
Castle's user avatar
  • 127
4 votes
1 answer
228 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 ...
Pxx's user avatar
  • 681
9 votes
0 answers
785 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 ...
Santiago's user avatar
  • 1,201
2 votes
0 answers
45 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:...
user196574's user avatar
1 vote
1 answer
72 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, ...
alancalvitti's user avatar
1 vote
0 answers
63 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 ...
User9495's user avatar
2 votes
2 answers
178 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 ...
Aaron's user avatar
  • 93
0 votes
0 answers
98 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 ...
bford16's user avatar
  • 101
2 votes
1 answer
266 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? ...
Jan Eerland's user avatar
  • 1,941
1 vote
1 answer
84 views

Generalization of code is slower than particular case

I wrote the following Mathematica module: ...
user68161's user avatar
  • 153
2 votes
3 answers
106 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... ...
LCarvalho's user avatar
  • 9,145
10 votes
1 answer
614 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 <...
Max Coplan's user avatar
3 votes
2 answers
318 views

Interpolation works slowly

Consider the following code: ...
John Taylor's user avatar
  • 4,984
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 ...
Jaigus's user avatar
  • 257
5 votes
3 answers
2k 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
265 views

Reduce Plot3D evaluation time?

I have a large function func[a,b] and I need its Plot3D. Since the command ...
VP06's user avatar
  • 25
15 votes
1 answer
572 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 ...
JEM's user avatar
  • 1,147