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

Math optimizations #2115

Merged
merged 17 commits into from
Sep 5, 2024
Merged

Math optimizations #2115

merged 17 commits into from
Sep 5, 2024

Conversation

smilediver
Copy link
Contributor

Mostly moves some trivial and commonly used methods in math classes to headers so that they can be inlined by compiler.

@paulocoutinhox
Copy link
Contributor

What is inl file?

Copy link
Collaborator

@halx99 halx99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer just implement inline APIs in class define directly, don't create individual .inl file if the inline APIs are public

core/math/Color.inl Outdated Show resolved Hide resolved
core/math/Mat4.inl Outdated Show resolved Hide resolved
core/math/Rect.inl Outdated Show resolved Hide resolved
core/math/Vec4.inl Outdated Show resolved Hide resolved
core/math/Quaternion.inl Outdated Show resolved Hide resolved
@smilediver
Copy link
Contributor Author

smilediver commented Aug 30, 2024

Should I put definitions with declarations like so:

class Color {
    void method() { doStuff(); }
};

or keep declarations clean and put definitions at the end of file like this:

class Color {
    void method();
};

void Color::method() { doStuff(); }

or maybe something in between, like keep shorter definitions with declarations, but keep larger definitions at the end of file?

@halx99
Copy link
Collaborator

halx99 commented Aug 30, 2024

I prefer first one, less code

@halx99 halx99 added this to the 2.2.0 milestone Sep 5, 2024
@halx99 halx99 merged commit 7b377d6 into axmolengine:dev Sep 5, 2024
15 checks passed
@smilediver smilediver deleted the math_optimizations branch September 5, 2024 19:36
xfbird pushed a commit to xfbird/axmol that referenced this pull request Sep 18, 2024
* Mat4: make some methods inlineable

* Vec3: make some methods inlineable

* Vec4: make some methods inlineable

* Color: make some methods inlineable

* Quaternion: make some methods inlineable

* Rect: make some methods inlineable

* Vec2: make some methods inlineable

* Math: mark constants inline

* Math: fix DLL build

* Vec2: make constants inlineable

* Color: remove inline file

* Mat4: remove inline file

* Quaternion: remove inline file

* Rect: remove inline file

* Vec2: remove inline file

* Vec3: remove inline file

* Vec4: remove inline file
xfbird pushed a commit to xfbird/axmol that referenced this pull request Sep 18, 2024
* Mat4: make some methods inlineable

* Vec3: make some methods inlineable

* Vec4: make some methods inlineable

* Color: make some methods inlineable

* Quaternion: make some methods inlineable

* Rect: make some methods inlineable

* Vec2: make some methods inlineable

* Math: mark constants inline

* Math: fix DLL build

* Vec2: make constants inlineable

* Color: remove inline file

* Mat4: remove inline file

* Quaternion: remove inline file

* Rect: remove inline file

* Vec2: remove inline file

* Vec3: remove inline file

* Vec4: remove inline file
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.

3 participants