mxtlrr / treng

Hyperoperation engine with it's own homebrew big number library.
1 stars 0 forks source link

Super slow -- probable rewrite? #4

Open mxtlrr opened 1 month ago

mxtlrr commented 1 month ago
Yeah. Even though treng has gone through a rewrite from C++ to JavaScript, the JavaScript rewrite is actually slower! Computing Function C++ Time JavaScript Time
$f(2,4)$ ~0.2-0.4s 30s - 3 min
$f(2,5)$ ~0.6-0.8s 1-4 min
$f(2,6)$ N/A >1 hr

Obviously, the data shows that JS may not be the perfect language for this. However, this also may be due to unoptimized functions (#1), but it also may be that string operations where the length of the string $n$ is $> 10^{50}$ digits. This issue is only here to document a potential rewrite / optimizations of other functions that do not fit into pre-existing issues.

mxtlrr commented 1 month ago

$f(2,5)$ was computed in 113s while $f(2,4)$ was computed in 0.29s. From other tests, it seems like BOTH operations are slow!

Operation Time
$\sum_{n=1}^{50}{2}$ ~0.36s
$\prod_{n=1}^{50}{2}$ ~0.21s

Sadly, javascript is not really multithreaded -- this means we might have to go back to our roots in C++.

mxtlrr commented 1 month ago
An updated table of JS rewrite's timing function (lowest was taken): Function $f$ Time
$f(2,1)$ 0.1559s
$f(2,2)$ 0.0179s
$f(2,3)$ 0.0090s
$f(2,4)$ 0.2699s
$f(2,5)$ 69.401s
$f(2,6)$ Unknown $^1$

$^1$: $f(2,6)$ has never been computed with treng yet.