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

WireLib.clampPos/Force optimization #3221

Merged
merged 5 commits into from
Dec 16, 2024
Merged

Conversation

Astralcircle
Copy link
Contributor

Speeds up WireLib.clampPos by about 2x and WireLib.clampForce by about 5x

Speeds up WireLib.clampPos by about 2x and WireLib.clampForce by about 5x
lua/wire/wireshared.lua Outdated Show resolved Hide resolved
@thegrb93
Copy link
Contributor

Can you use unpack in clampPos too?

@thegrb93 thegrb93 merged commit a14a2c7 into wiremod:master Dec 16, 2024
1 check passed
@Astralcircle Astralcircle deleted the wirelib branch December 16, 2024 15:57
@Divran
Copy link
Contributor

Divran commented Dec 16, 2024

how does this change handle NaN

@thegrb93
Copy link
Contributor

thegrb93 commented Dec 16, 2024

print(math.Clamp(0/0, -100, 100))...
100

@Divran
Copy link
Contributor

Divran commented Dec 16, 2024

so someone fixed it in gmod, then, since we had these checks in place specifically because clamp didn't handle it previously. looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants