0 registered members (),
677
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
clampV a instruction to clamp vectors
#450896
04/24/15 14:37
04/24/15 14:37
|
Malice
Unregistered
|
Malice
Unregistered
|
Hi, I've written a simple function so I can clamp independently the elements of a vector. I am just wondering if a function like this would be faster if it was part of the engine instruction set?
clampv(VECTOR to return, VECTOR to clamp, var lower A, var lower B, var lower C, var upper A ,var upper B,var upper C);
Thanks Mal
|
|
|
Re: clampV a instruction to clamp vectors
[Re: ]
#450899
04/24/15 14:44
04/24/15 14:44
|
Joined: Apr 2005
Posts: 1,988 Canadian, Eh
DLively
Serious User
|
Serious User
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
|
This doesn't answer your question, and im also not a developer, but without seeing the functions guts, it looks like you could shorten your last 6 vars to Vectors, and that would likely save you the resources your looking to save. clampv(VECTOR to return, VECTOR to clamp, VECTOR lower, VECTOR upper); you could then access upper A as upper.x, upper B as upper.y and so on... Hope this helps.
|
|
|
Re: clampV a instruction to clamp vectors
[Re: jcl]
#450924
04/24/15 20:51
04/24/15 20:51
|
Joined: Oct 2007
Posts: 5,210 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
|
another question on point, would such function be faster(even if marginally) when it's a lite-c function or an engine plugin function?
3333333333
|
|
|
Re: clampV a instruction to clamp vectors
[Re: Quad]
#450925
04/24/15 21:55
04/24/15 21:55
|
Malice
Unregistered
|
Malice
Unregistered
|
Thank you jcl for the answer. Thanks Dlively for pointing out the other vectors.
|
|
|
Re: clampV a instruction to clamp vectors
[Re: Quad]
#450926
04/24/15 22:00
04/24/15 22:00
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
What kind of optimizations does the Lite-C compiler perform anyway? In my experience from some time ago, it wasn't really doing a great job at optimizing code and especially modern compilers have a huge array of optimizations they can perform which speed up more than just loops.
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
|
|
|
Re: clampV a instruction to clamp vectors
[Re: jcl]
#450951
04/25/15 14:12
04/25/15 14:12
|
Joined: Dec 2011
Posts: 1,823 Netherlands
Reconnoiter
Serious User
|
Serious User
Joined: Dec 2011
Posts: 1,823
Netherlands
|
The lite-C compiler does not optimize. So a DLL function can be indeed up to 50% faster when created with an optimizing compiler such as VC++.
But you normally will only notice a difference when the function contains large loops. Otherwise the function can be written in lite-C or in VC++ without much effect on the total script execution speed. , how large loops are we talking about? tia for your time.
|
|
|
|