Oxygen Basic

Programming => Example Code => Topic started by: Peter on August 06, 2014, 09:36:33 AM

Title: Own Apis Declarations
Post by: Peter on August 06, 2014, 09:36:33 AM
Deleted!
Title: Re: Own Apis Declarations
Post by: Mike Lobanovsky on August 06, 2014, 11:24:52 AM
Peter,

I would suggest

Code: [Select]
............
sn = sin(0.8 * f) * 160-x+160
cs = cos(1.2 * f) * 100-y+100
c2 = sqr(sn*sn + cs*cs)
............

to make it run ultimately fast. Oxygen doesn't have an optimizer to rearrange the code in such a way automatically. By the way, the language from which you took this snippet literally doesn't have any such optimization either.
Title: Re: Own Apis Declarations
Post by: Mike Lobanovsky on August 06, 2014, 01:04:43 PM
Sure.

But something is telling me the code came all the way from there (http://forum.basicprogramming.org/index.php/topic,3408.msg24278.html#msg24278). :)

Lua doesn't have code optimization to fix these expressions so such coding style would be a speed killer for its interpretative environment. We're just not seeing this here thanks to the underlying JIT assembly. But the lag is there anyway.
Title: Re: Own Apis Declarations
Post by: Mike Lobanovsky on August 06, 2014, 01:43:33 PM
Why Peter, thanks! :)

I am simply not registered at that forum and I cannot criticize Cybermonkey directly. This is why it's you who is the object of my trolling, simply because you didn't look at his careless implementation at a critical angle.

Please don't get angry with me. I am all for cleaner and faster code and not after you personally. I would have chased your friend Aurel with similar criticisms had it been his submission and not yours. :)
Title: Re: Own Apis Declarations
Post by: Mike Lobanovsky on August 06, 2014, 02:15:56 PM
So, either your way or no way again?

Well, well... Happy coding! :-X