ad icon indicating copy to clipboard operation
ad copied to clipboard

Implement `fast-math` Version of `ReverseDouble` with `+ffi`

Open julmb opened this issue 1 year ago • 4 comments

  1. I wonder if it is worth adding a "fast-math" version of ReverseDouble that achieves better performance at the expense of not being correct with respect to special IEEE floating-point values. This would be more work, but it would give a better migration story for anyone whose applications' performance might be negatively impacted by these changes.

Originally posted by @RyanGlScott in https://github.com/ekmett/ad/issues/105#issuecomment-1660229399

julmb avatar Aug 23 '23 11:08 julmb

This is the relevant position in the code for this issue: https://github.com/ekmett/ad/blob/18efa2c04fb72c60507c6a53b714851a8c110bdc/cbits/tape.c#L90-L108

julmb avatar Aug 23 '23 13:08 julmb

Did including this check create a measurable change in any large examples? I forget if we discussed this before

cartazio avatar Oct 04 '23 22:10 cartazio

@julmb has some large ad-based projects that incur a slight performance penalty because of this, if I understand https://github.com/ekmett/ad/pull/105#issue-1791893479 correctly.

RyanGlScott avatar Oct 04 '23 23:10 RyanGlScott

Did including this check create a measurable change in any large examples? I forget if we discussed this before

Yes, in my application this would result in a performance improvement of around 20%.

julmb avatar Oct 07 '23 01:10 julmb