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

Ref/In for better performance ? #16

Open
genaray opened this issue Oct 27, 2021 · 6 comments
Open

Ref/In for better performance ? #16

genaray opened this issue Oct 27, 2021 · 6 comments

Comments

@genaray
Copy link

genaray commented Oct 27, 2021

First of all, thanks a lot for this awesome lib !

Would it be possible to introduce ref/in parameters for the most used operations ? This would increase the performance by a lot if structs are used as points instead of classes. Furthermore its still compatible with the normal class approach :)

@splitice
Copy link
Owner

Possibly, do you have a benchmark showing an improvement in performance?

@genaray
Copy link
Author

genaray commented Oct 27, 2021

Possibly, do you have a benchmark showing an improvement in performance?

Wow thanks for the fast answer ! :) No i have not... but its no secret that refs and ins are faster when structs are being used. Refs wont copy the passed struct, they act as a real reference to it. So i bet we could save a lot of possible copy operations by passing generecs as refs in certain places.

Of course we just could use classes ( which are always ref )... but i like to reduce memory usage and for my game its actually pretty important to use structs... implementing refs and ins do not have any downside ^^

@splitice
Copy link
Owner

splitice commented Oct 29, 2021

Benchmark showing performance with class (at-least not regressing) and with struct and I'll merge.

I'm not using this library these days so I depend on such tests and data to detirmine direction.

I must admit I'm not super familiar with in/ref in C# but the C++ programmer in me tends to agree that it should be faster unless the compiler does move semantics or inlining (for what native land overlaps in .NET jit...)

@genaray
Copy link
Author

genaray commented Oct 30, 2021

Benchmark showing performance with class (at-least not regressing) and with struct and I'll merge.

I'm not using this library these days so I depend on such tests and data to detirmine direction.

I must admit I'm not super familiar with in/ref in C# but the C++ programmer in me tends to agree that it should be faster unless the compiler does move semantics or inlining (for what native land overlaps in .NET jit...)

Alright thanks ! So i should fork this repo, implement the changes by myself, benchmark them and if it is faster than you will merge those changes ? ^^

@splitice
Copy link
Owner

Yes

@Alumniminium
Copy link

any progress on this?

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

No branches or pull requests

3 participants