| 57 | } |
| 58 | |
| 59 | function ceBaselineN(numRandos: number[]): number { |
| 60 | const ce = new ComputeEngine(); |
| 61 | |
| 62 | let randos = numRandos.map((n) => ce.number(n)); |
| 63 | |
| 64 | let start = globalThis.performance.now(); |
| 65 | |
| 66 | randos = randos.map((n, i) => { |
| 67 | // Do some arithmetic calculations |
| 68 | if (i % 2 === 0) |
| 69 | return n.mul(4).pow(2).div(3).add(n.mul(3).div(2)).add(2).N(); |
| 70 | |
| 71 | // Trigonometry, log, exp |
| 72 | return ce.expr(['Add', ['Tan', n], ['Log', ['Abs', n]], ['Exp', n]]).N(); |
| 73 | }); |
| 74 | |
| 75 | return globalThis.performance.now() - start; |
| 76 | } |
| 77 | |
| 78 | function slowEval() { |
| 79 | const ce = new ComputeEngine(); |