Fermat icon indicating copy to clipboard operation
Fermat copied to clipboard

Increase Performance on Trig Functions

Open JordanRL opened this issue 2 years ago • 0 comments

Currently the inverse trig functions average around 50 operations per second, and the normal trig functions around 600-700. Current performance: (NOTE: the numerical values depend on the system and are only relevant in comparison to future numbers generated on my development box.)

Function Ops/Sec Equivalent md5() Hashes
sin() 657 12590
cos() 745 11079
tan() 208 39622
sec() 703 11744
csc() 618 13353
cot() 160 51400
----- --- ----
arcsin() 45.3 182144
arccos() 42.6 193546
arctan() 36.5 226051
arcsec() 54.2 152068
arccsc() 58.6 140874
arccot() 33.8 244096

Current bottlenecks are primarily:

  • Dependence on Bernoulli Number generation (extremely slow to calculate, need implementation based on D. Harvey et. al. binary algorithm)
  • Dependence on compound and iterative calls to other expensive functions (such as natural log)
  • Lack of shortcuts for easier to calculate values (i.e., values within the bounds and scale of the native functions)
  • Implemented mainly as Maclauren/Taylor series (slower converging)

JordanRL avatar Jul 13 '21 20:07 JordanRL