Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upInvestigate potentially more efficient calculation methods #181
Comments
This comment has been minimized.
This comment has been minimized.
MicrosoftIssueBot
commented
Mar 7, 2019
|
This is your friendly Microsoft Issue Bot. I've seen this issue come in and have gone to tell a human about it. |
MicrosoftIssueBot
added
the
triage needed
label
Mar 7, 2019
This comment has been minimized.
This comment has been minimized.
AeSix
commented
Mar 7, 2019
|
Faster apps are not better if they are inaccurate. I feel like this is another troll, just a well thought out troll. You can always fork, "fix" and PR. |
This comment has been minimized.
This comment has been minimized.
|
This is not a troll (although I can understand why you're suspicious, because of another issue complaining about the use of "master" in Git), and Chebyshev polynomials are faster for a given accuracy than Taylor series, so it's not a matter of a tradeoff between speed and accuracy; I may well go the PR route, in case anyone from Microsoft happens to also consider this issue a troll. (I have closed the issue after investigating for myself and finding only a tiny potential improvement.) |
lewisje
closed this
Mar 8, 2019
MicrosoftIssueBot
added
the
won't fix
label
Mar 8, 2019
This comment has been minimized.
This comment has been minimized.
|
I think it's awesome that you looked into this, even though it ultimately didn't lead to improvements. Thanks for trying it out! |
lewisje commentedMar 7, 2019
•
edited
Problem Statement
You should look into ways to approximate mathematical functions that are more efficient than Taylor series.(I did a bit and found only a micro-optimization that doesn't work on ARMv7.)Evidence or User Insights
Faster apps are better.
Proposal
The use of
CORDICs orbuilt-in mathematical functions (depending on what our supported CPU architectures have)or Chebyshev polynomialsis more efficient for approximating functions over an interval than Taylor series, particularly far from the point at which the Taylor series is generated.Goals
Calculate mathematical functions more quickly.
Non-Goals
Support the same CPU architectures as in Windows 3, with their limited built-in mathematical functions.
Low-Fidelity Concept
Look up the set of mathematical functions supported as CPU instructions by all supported architectures and replace the corresponding mathematical functions with them~~, and depending on whether they are faster, use Chebyshev polynomials or CORDICs instead of Taylor series for the rest~~.
EDIT: On briefly trying it out for myself, I have concluded that Chebyshev polynomials might not be such a good idea, considering as an example that the first coefficient in the expansion of sinh over [-1,1] is irrational, and the expansion definitely does not have the sort of pattern that the Maclaurin series does, which allows each term to be quickly calculated from the previous term.
Also, the ARMv7 architecture (the minimum for Windows 10 on ARM) has no built-in mathematical functions, and the only useful ones in SSE2 (the minimum for Windows 10 on x86) are square root and reciprocal of square root, which might be a faster conditional branch from the code path that interprets x^y as exp(y*ln(x)), but only if y is a positive-integer power of 2 or its negative.
Finally, CORDICs are best used for CPUs without multiply instructions, while both ARMv7 and SSE2 have multiply instructions.