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

Some general Vector4 optimizations #295

Merged
merged 5 commits into from
Nov 27, 2023
Merged

Conversation

spydon
Copy link
Collaborator

@spydon spydon commented May 26, 2023

Since the Vector4.zero constructor was already a normal named constructor it was already possible to extend the class.

  • Converts all factory constructors (except Vector4.random) to named constructors that directly sets the storage instead of calling intermediary methods to do it.
  • Simplifies length2, dot, isInfinite and isNaN.
  • Optimizes reflect, relativeError and absoluteError so that they don't create extra Vector4 objects.
  • Orders all operations made on _v4storage from 1 to 0 so that it is consistent across the class and guarantees that bounds checking is only done once.

@coveralls
Copy link

coveralls commented May 26, 2023

Coverage Status

coverage: 26.312% (-0.06%) from 26.369% when pulling 441d253 on spydon:fix/vector4 into 47a08ea on google:master.

@johnmccutchan
Copy link
Collaborator

What is going on with the code coverage? That is a steep drop.

@spydon
Copy link
Collaborator Author

spydon commented May 31, 2023

What is going on with the code coverage? That is a steep drop.

That is very strange... Are you sure the coveralls check ran properly?

@kevmoo
Copy link
Collaborator

kevmoo commented Jul 17, 2023

Just reran for giggles. It seems coverage fell off a cliff before this change. Maybe rebase on master?

@spydon
Copy link
Collaborator Author

spydon commented Jul 17, 2023

Just reran for giggles. It seems coverage fell off a cliff before this change. Maybe rebase on master?

It has the same coverage percentage on master now 🤷‍♂️
(I can rebase tomorrow when I'm back at the computer)

@spydon spydon force-pushed the fix/vector4 branch 2 times, most recently from 78fbb96 to 102efd5 Compare July 18, 2023 12:21
@spydon spydon changed the title Use named constructors in Vector4 and some general optimizations Some general Vector4 optimizations Oct 4, 2023
@johnmccutchan johnmccutchan merged commit e4066cc into google:master Nov 27, 2023
3 checks passed
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