- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a few question to know "how" I should write my methods. Can you tell me which one is the fast one ?
By example to pass values to a method :
1 - Passing float3 by pointer
void mymethod(float3* a, float3* b, float3* result)....2 - Passing float3 directly
void mymethod(float3 a, float3 b, float3* result)....
3 - using "const" allowing the compiler to keep "a" and avoir a copy when entering into the method
void mymethod(const float3 a, const float3 b, float3* result)....
And to return values
1 - By pointer
void mymethod(float3* a, float3* b, float3* result)....
float3 a;
mymethod(&a);
2 - By value
float3 mymethod(float3* a, float3* b)....
float3 a = mythod(...);
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Good questions. I'm also interestered in this!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In most of the cases the compiler will perform in-lining, hence there is no much differences.
If for some reason the compiler can't perform in-lining the following method is preferred.
float3 mymethod(float3,float3);
In any case, I advise you to use the "Offline compiler" tool and look for thex86 assembly.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page