You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Structs are commonly used in game engines and standalone math libraries to store coordinates, transformation matrices and other similar values. Operators are the most convenient way to expose operations on these structs.
However, operators require that their parameters are passed by value. Copying large structs takes up to 40% of the execution time in microbenchmarks.
Solution
If #38 is implemented, readonly ref operators can be introduced. They are created by marking their parameters with in ref kind.
The following operators should be compiled into a void-returning method with 1 or 2 in parameters and one out parameter (this is faster than returning the result):
unary +, -
binary +, -, *, /, %, &, |, ^, <<, >>
The following methods should be compiled into a bool-returning method with 1 or 2 in parameters:
unary true, false
binary ==, !=, >, <, >=, <=
Open questions
Should it be possible to have one in parameter and one RefKind.None parameter for passing smaller value types or reference types?
The text was updated successfully, but these errors were encountered:
Problem
Structs are commonly used in game engines and standalone math libraries to store coordinates, transformation matrices and other similar values. Operators are the most convenient way to expose operations on these structs.
However, operators require that their parameters are passed by value. Copying large structs takes up to 40% of the execution time in microbenchmarks.
Solution
If #38 is implemented,
readonly ref
operators can be introduced. They are created by marking their parameters within
ref kind.The following operators should be compiled into a
void
-returning method with 1 or 2in
parameters and oneout
parameter (this is faster than returning the result):+
,-
+
,-
,*
,/
,%
,&
,|
,^
,<<
,>>
The following methods should be compiled into a
bool
-returning method with 1 or 2in
parameters:true
,false
==
,!=
,>
,<
,>=
,<=
Open questions
Should it be possible to have one
in
parameter and one RefKind.None parameter for passing smaller value types or reference types?The text was updated successfully, but these errors were encountered: