Post Reply 
Summation based benchmark for calculators
11-16-2018, 06:52 PM
Post: #144
RE: Summation based benchmark for calculators
(01-02-2018 10:57 AM)grsbanks Wrote:  ...
One way round it is to use the fact that \( sin(atan(x)) = { x \over \sqrt(1+x^2) } \) Smile

That, however, doesn't benchmark the trig functions, so any results obtained would not be relevant to this particular test.

Taking a look at the UserRPL Σ (summation) vs. SysRPL looped versions of the 50g results was puzzling me, as I didn't see how Σ could possibly be executing a symbolic UserRPL expression with type checking faster than a simple SysRPL loop could step through the same calculations without the type checks. That prompted me to dig a bit into the Σ command, which in turn provided the answer: Σ uses the CAS to simplify the expression prior to looping through the summation, which ends up applying the same optimization you've identified above (\( sin(atan(x)) = { x \over \sqrt{1+x^2} } \)). In my mind, that would appear to invalidate the 50g benchmarks that use the summation notation since they aren't actually performing the same series of computations as the other platforms. I'm assuming, of course, that none of the other non-RPL calculators perform a similar optimization prior to summing the values. I have no way of knowing if that's a safe assumption, though.

To put this into perspective, a 50g SysRPL implementation that takes advantage of this same simplification could be as follows:
Code:
::
   SETRAD
   %0 DUP
   1000 ZERO_DO (DO)
      SWAP %1+ SWAPOVER
      DUPDUP %*
      %1+
      %SQRT
      %/
      %EXP
      %3 %NROOT
      %+
   LOOP
   SWAPDROP
;
(Execution time: about 18s on 50g)

That compares more reasonably with the UserRPL Σ version(s) that complete in about 25s, also yielding the same result. This could be made even faster (16s) by performing extended real calculations and raising the final term to the 1/3 power instead of finding the cube root.

It's possible that there's some combination of modes/flag settings that will disable the automatic simplification process that Σ performs, but I haven't tried to find them. As it stands now, I don't believe the 50g UserRPL Σ versions are appropriate to include with the other benchmarks since they aren't actually performing the intended computations defined by the test.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Summation based benchmark for calculators - DavidM - 11-16-2018 06:52 PM



User(s) browsing this thread: 34 Guest(s)