Gamestudio Links
Zorro Links
Newest Posts
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
Data from CSV not parsed correctly
by jcl. 04/20/24 08:32
Zorro FIX plugin - Experimental
by jcl. 04/20/24 08:30
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (7th_zorro, Aku_Aku, 1 invisible), 579 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
clampV a instruction to clamp vectors #450896
04/24/15 14:37
04/24/15 14:37

M
Malice
Unregistered
Malice
Unregistered
M



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 Offline
Serious User
DLively  Offline
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... laugh

Hope this helps.


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: clampV a instruction to clamp vectors [Re: DLively] #450912
04/24/15 16:19
04/24/15 16:19
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
Litec-C functions normally not become faster when integrated in the engine. Although VC++ compiles slightly better code than lite-C, the difference is normally only noticeable when the function contains complex loops.

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 Offline
Senior Expert
Quad  Offline
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

M
Malice
Unregistered
Malice
Unregistered
M



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 Offline
Expert
WretchedSid  Offline
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: WretchedSid] #450943
04/25/15 08:24
04/25/15 08:24
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
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.

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 Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Originally Posted By: jcl
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.

Re: clampV a instruction to clamp vectors [Re: Reconnoiter] #451018
04/27/15 07:19
04/27/15 07:19
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
by the way, it would be more elegant to create support for more types. I mean in general, not only in this particular case. it could be on engine level or via some little lite-c helper packages. for example dynamic memory and dynamic 1D/2D array handling would also require such a support. it would be not a big effort, only a little boring to implement. laugh


Free world editor for 3D Gamestudio: MapBuilder Editor

Moderated by  old_bill, Tobias 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1