Skip to content

Commit 45b80ed

Browse files
committed
Updated Exprtk
1 parent 703b1a0 commit 45b80ed

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

exprtk/readme.txt

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3558,9 +3558,28 @@ evaluated 100K times can be executed as follows:
35583558
[*] Total Single Eval Time: 0.000ms
35593559

35603560

3561-
From the results above we can see that the third expression (e^(3y))
3562-
consumes the largest amount of time and should perhaps be replaced
3563-
with the 'exp' function for more efficient evaluation.
3561+
From the results above we conclude that the third expression (e^(3y))
3562+
consumes the largest amount of time. The variable 'e', as used in both
3563+
the benchmark and in the expression, is an approximation of the
3564+
transcendental mathematical constant e (2.71828182845904...) hence the
3565+
sub-expression should perhaps be modified to use the generally more
3566+
efficient built-in 'exp' function.
3567+
3568+
./exprtk_benchmark test.txt 1000000
3569+
Expr 1 of 5 86.563 ns 8656300ns (296417859.6) '1/sqrt(2x)*e^(3y)'
3570+
Expr 2 of 5 40.506 ns 4050600ns (296417859.6) '1/sqrt(2x)*exp(3y)'
3571+
Expr 3 of 5 14.248 ns 1424799ns ( 44267.2) '1/sqrt(2x)'
3572+
Expr 4 of 5 88.840 ns 8884000ns (615985286.9) 'e^(3y)'
3573+
Expr 5 of 5 29.267 ns 2926699ns (615985286.9) 'exp(3y)'
3574+
[*] Number Of Evals: 5000000
3575+
[*] Total Time: 0.260sec
3576+
[*] Total Single Eval Time: 0.000ms
3577+
3578+
3579+
The above output demonstrates the results from making the previously
3580+
mentioned modification to the expression. As can be seen the new form
3581+
of the expression using the 'exp' function reduces the evaluation time
3582+
by over 50%, in other words increases the evaluation rate by two fold.
35643583

35653584
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35663585

0 commit comments

Comments
 (0)