Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replacement for fastled sqrt16() #4426

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

DedeHai
Copy link
Collaborator

@DedeHai DedeHai commented Dec 24, 2024

replacing yet another fastled function: it is about 10% slower for numbers smaller 128 but faster for larger numbers. Speed difference is irrelevant to WLED (we are talking 30ns slower per call on a C3) but it saves some flash and takes us one step closer to ditching fastled.

- replacement for fastled, it is about 10% slower for numbers smaller 128 but faster for larger numbers. speed difference is irrelevant to WLED but it saves some flash.
@softhack007 softhack007 added the optimization re-working an existing feature to be faster, or use less memory label Dec 28, 2024
wled00/FX_fcn.cpp Outdated Show resolved Hide resolved
- making it 32bits allows for larger numbers
- added another initial condition check for medium sized numbers
- increased the "small number" optimization to larger numbers: the function is currently only used to calculate sqrt(x^2+y^2) which even for small segments is larger than the initially used 64, so optimizing for 1024 makes more sense, although the value is arbitrarily chosen
@netmindz netmindz requested a review from softhack007 January 9, 2025 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimization re-working an existing feature to be faster, or use less memory
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants