Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
TNT Collision Engine C Native Plugin - *** NEXT RELEASE *** — Gideros Forum

TNT Collision Engine C Native Plugin - *** NEXT RELEASE ***

GregBUGGregBUG Guru
edited February 2014 in Plugins
Hi! guys after some time of pause with gideros i'm back.

now i'm working on a big project (management software) and in my free time i try to restart to work with Gideros and my tnt Engine. (and make something useful for the community because i'm not good on writing tutorials and write in english).

my plan is to convert almost everything (tnt engine) in native plugins...

i restart from tnt collision engine ....
and now i'm adding some useful math functions...
that will help me also on other engine parts (Virual Pad, Particles, Animations).

for now i added this functions:
+ getDirection                                
+ getDistance                                 
+ getAngleDifference                         
+ getXLenDir                                  
+ getYLenDir                                
+ getXYLenDir                                 
+ min                                         
+ max                                         
+ lerp
+ clamp
except for "lerp" (i will investigate) we got a nice boost from lua code.
[EDIT] 22% faster on real devices (tested on iPhone 4gs, ipad 4 retina).

if you have some nice ideas or math functions that you want to add just let me know i'll try to add to the lib.

here is actual benchmarks:
---------------------------------------------------------
Testing "getDirection" implementation: (lua and C code 1000000 for/loop cycles)
>> LUA TIME >>0.189142
>> C++ TIME >>0.11687599999999
on 1000000 cycles
C++ Version is 38.207272842632% FASTER !!!
---------------------------------------------------------
Testing "getDistance" implementation: (lua and C code 1000000 for/loop cycles)
>> LUA TIME >>0.17260200000004
>> C++ TIME >>0.10276900000002
C++ Version is 40.458974982909% FASTER !!!
---------------------------------------------------------
Testing "getAngleDifference" implementation: (lua and C code 1000000 for/loop cycles)
>> LUA TIME >>0.18342899999999
>> C++ TIME >>0.091700000000003
C++ Version is 50.00790496595% FASTER !!!
---------------------------------------------------------
Testing "getXLenDir" implementation: (lua and C code 1000000 for/loop cycles)
>> LUA TIME >>0.15209499999997
>> C++ TIME >>0.089488999999958
C++ Version is 41.162431375145% FASTER !!!
---------------------------------------------------------
Testing "getYLenDir" implementation: (lua and C code 1000000 for/loop cycles)
>> LUA TIME >>0.15183300000001
>> C++ TIME >>0.095704999999953
C++ Version is 36.966930772661% FASTER !!!
---------------------------------------------------------
Testing "getXYLenDir" implementation: (lua and C code 1000000 for/loop cycles)
>> LUA TIME >>0.23478999999998
>> C++ TIME >>0.10216600000001
C++ Version is 56.486221730047% FASTER !!!
---------------------------------------------------------
Testing "lerp" implementation: (lua and C code 1000000 for/loop cycles)
>> LUA TIME >>0.091988000000015
>> C++ TIME >>0.092349000000013
C++ Version is 0.39244249249684% SLOVER !!!
---------------------------------------------------------
Testing "clamp" implementation: (lua and C code 1000000 for/loop cycles)
>> LUA TIME >>0.21178600000002
>> C++ TIME >>0.09044300000005
C++ Version is 57.295099770503% FASTER !!!
hope can help community.


release scheduled in some days... or better :)

ciao!
;)

Likes: SinisterSoft

TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
www.tntengine.com
+1 -1 (+1 / -0 )Share on Facebook
«1

Comments

  • What is the speed difference on Android (LuaJIT), are they about the same or is the C version still a lot faster?
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • @SinisterSoft
    lua jit not tested because i have no access on it... :(

    if you can try luajit i can sent you the beta of tnt collision lib and test... :)
    (should be fine)

    ?
    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • ok. I will do that no problem.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • email sent. :)
    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • @GregBUG: Not got it, can you send again or put it in a dropbox and PM me on the forum?
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • @SinisterSoft it's ok now ?
    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • Looks like LuaJIT is much faster...

    main.lua is uploading.
    Uploading finished.
    ---------------------------------------------------------
    Testing "getDirection" implementation: (lua and C code 1000000 for/loop cycles)
    >> LUA TIME >>0.060204999999996
    >> C++ TIME >>0.50636499999996
    on 1000000 cycles
    C++ Version is 741.0680176065% SLOVER !!!
    ---------------------------------------------------------
    Testing "getDistance" implementation: (lua and C code 1000000 for/loop cycles)
    >> LUA TIME >>0.0020439999998416
    >> C++ TIME >>0.28566299999989
    C++ Version is 13875.684932584% SLOVER !!!
    ---------------------------------------------------------
    Testing "getAngleDifference" implementation: (lua and C code 1000000 for/loop cycles)
    >> LUA TIME >>0.3761770000001
    >> C++ TIME >>0.21347800000012
    C++ Version is 43.250650624555% FASTER !!!
    ---------------------------------------------------------
    Testing "getXLenDir" implementation: (lua and C code 1000000 for/loop cycles)
    >> LUA TIME >>0.0023140000000694
    >> C++ TIME >>0.2540640000002
    C++ Version is 10879.429558884% SLOVER !!!
    ---------------------------------------------------------
    Testing "getYLenDir" implementation: (lua and C code 1000000 for/loop cycles)
    >> LUA TIME >>0.001254999999901
    >> C++ TIME >>0.24380999999994
    C++ Version is 19327.091634994% SLOVER !!!
    ---------------------------------------------------------
    Testing "getXYLenDir" implementation: (lua and C code 1000000 for/loop cycles)
    >> LUA TIME >>0.0013020000001234
    >> C++ TIME >>0.34724600000004
    C++ Version is 26570.199690256% SLOVER !!!
    ---------------------------------------------------------
    Testing "lerp" implementation: (lua and C code 1000000 for/loop cycles)
    >> LUA TIME >>0.0018279999999322
    >> C++ TIME >>0.213616
    C++ Version is 11585.776805685% SLOVER !!!
    ---------------------------------------------------------
    Testing "clamp" implementation: (lua and C code 1000000 for/loop cycles)
    >> LUA TIME >>0.0016729999999825
    >> C++ TIME >>0.24562199999991
    C++ Version is 14581.530185444% SLOVER !!!
    ---------------------------------------------------------
    Testing "circularClamp" implementation: (lua and C code 1000000 for/loop cycles)
    >> LUA TIME >>0.0012669999998707
    >> C++ TIME >>0.39937899999995
    C++ Version is 31421.625891138% SLOVER !!!
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • On iOS the LuaJIT is still done using interpretation, so they might be closer on that.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • wow!!!
    so don't need to convert in c ?

    there is a really BIG difference....
    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • It would be interesting to see the difference with your normal collision routines.

    Also to try it on iOS.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • GregBUGGregBUG Guru
    edited February 2014
    @SinisterSoft

    yes.
    if the differences are so big i think they works better in lua... than c...
    under ios luaJIT is not possibile right ? but how if faster than standard lua system?
    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • They wrote an optimised version of the Lua interpreter, it forks off a little though from the official line but it's 99.9% compatible.

    On iOS because of the apple rules it has to be interpreted still (but still faster than normal Lua) - but on Android it gets recompiled into assembly (native!) code.

    I use your collision routines even on Android because the code looks neater - I might just recode them as Lua routines though to see the difference.

    There is also a different/easier? binding system for LuaJIT <=> C that you might want to look at - it might get rid of some of the bottleneck your C routines have.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • C will start to have the advantage with much lower looping because the JIT might not be as effective at optimising the code. Problem is doing a test with just one or two loops is hard to measure.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • GregBUGGregBUG Guru
    edited February 2014
    just dropped on shared dropbox the lua code version of collision engine...

    ... :) should be fine if you can make some test! :)

    main bottleneck for little c function is that when you call a C function from lua code
    ALL params are passed from lua to C and then from c to lua...

    i think that luaJIT is the biggest (from my point of view) improvement that came to Gideros. next should be shaders...

    but... where is @atilim ?
    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • SinisterSoftSinisterSoft Maintainer
    edited February 2014
    I can do the test later today for you - go to do the school run first. :)
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • Wow, faster than C? It can't be? Could it?
    @MikeHart not yet but really soon to be :)
  • thanks to gideros stuff
    i can try and benchmark using luaJit now...

    more info and tests coming soon....

    :)

    if luaJIT is stable and fast enought (how seems to be)
    we don't need native c code now...

    so i can start to recode from scratch tnt particles 2 ...

    :D

    Likes: SinisterSoft

    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
    +1 -1 (+1 / -0 )Share on Facebook
  • Mmmm LuaJit is not allowed on iOS (and probably never will be), When working on iOS the performance of LuaJit is the same or slightly better than standard Lua cause they don't allow just in time compilation.

  • @GregBUG: You should do two versions of your libraries (native and Lua) - like @gianmichele mentioned, iOS does not get the JIT in LuaJIT - it is slightly better than slightly better though! ;)

    Android/Windows/Mac can use LuaJIT - the rest (iOS and possible Windows Phone 8 - or at this rate 9 ;p ) could use native...
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • @SinisterSoft @gianmichele @ar2rsawseen @atilim or anyone interessed... :)

    here is my test results...

    the test are very simple... looping 1000000 same functions (first in lua then luaJIT and then C++ code).

    result are strange... i know that luaJIT is beta but... here is the reults...

    1. on Desktop LuaJIT outperform LUA and C++ code as showed by @SinisterSoft.

    2. on DEVICE (iPhone 4S ios 7.0.6) LUA -LuAJIT same results (some millices differences some times better for lua some times better for LUAJIT... C++ code always faster 35-50%).

    3. On Android... here is the strange part..
    my test are done on QuadCore MTK6589 1.2Ghz andorid 4.2.1 STOCK rom.


    i used standard Gideros Player + my TNT Collision LIB (c++)
    and then the Gideros Player with modded LIBLUA (LUAJIT) provided with LuJIT package and my TNT Collision C++

    LUA is Faster than LUAJIT (ALOT) and c++ is always faster.

    here is some numbers...

    ---------------------------------------------------------
    Testing "getDirection" implementation: (lua and C code 1000000 for/loop cycles)
    >> LUA TIME >>0.12922200000003
    >> LUAJIT TIME >>12.191781
    >> C++ TIME >0.040789000000132
    ---------------------------------------------------------
    Testing "getDistance" implementation: (lua and C code 1000000 for/loop cycles)
    >> LUA TIME >>0.87321799999995
    >> LUAJIT TIME >>8.404098
    >> C++ TIME >>0.405303
    ---------------------------------------------------------
    Testing "getAngleDifference" implementation: (lua and C code 1000000 for/loop cycles)
    >> LUA TIME >>0.858746
    >> LUAJIT TIME >>0.49382299999991
    >> C++ TIME >>0.32814200000007
    ---------------------------------------------------------
    Testing "getXLenDir" implementation: (lua and C code 1000000 for/loop cycles)
    >> LUA TIME >>0.80873400000007
    >> LUAJIT TIME >>11.890431
    >> C++ TIME >>0.40018299999997
    ---------------------------------------------------------
    Testing "getYLenDir" implementation: (lua and C code 1000000 for/loop cycles)
    >> LUA TIME >>0.82719299999997
    >> LUAJIT TIME >>12.070643
    >> C++ TIME >>0.38011099999994
    ---------------------------------------------------------
    Testing "getXYLenDir" implementation: (lua and C code 1000000 for/loop cycles)
    >> LUA TIME >>1.290084
    >> LUAJIT TIME >>12.559666
    >> C++ TIME >>0.52168600000005

    ---------------------------------------------------------
    Testing "lerp" implementation: (lua and C code 1000000 for/loop cycles)
    >> LUA TIME >>0.470506
    >> LUAJIT TIME >>11.67021
    >> C++ TIME >>0.30802199999994
    ---------------------------------------------------------
    Testing "clamp" implementation: (lua and C code 1000000 for/loop cycles)
    >> LUA TIME >>1.018594
    >> LUAJIT TIME >>8.364654
    >> C++ TIME >>0.31064199999992
    ---------------------------------------------------------
    Testing "circularClamp" implementation: (lua and C code 1000000 for/loop cycles)
    >> LUA TIME >>1.590006
    >> LUAJIT TIME >>13.071062
    >> C++ TIME >>0.56435499999998


    at this point...

    1. is there something wrong in my device ?
    2. LuaJIT is beta so on arm device is not so fast ?

    LuaJIT on Android seems to be 10x slower that LUA.

    it's strange...
    but is alsto strange that on desktop luaJIT is 100x faster than c++ code...

    what do you think...

    i also tested "real" code (using oriented box to oriented box stess test 3 from my lib)

    using 500 box...

    on c++ code it takes 60-80 millisecs to render a frame...

    on lua about 300-350 ms at frame...

    lua jit.. 1300-1400ms at frame...
    c++ (using luajit runtime) 900-1000ms at frame...


    .... what do you think ?

    :-B :-B :-B :-B :-B :-B
    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • @GregBUG on Android the start/loading of the app is much slower, so how do you measure time, are you sure you are not measuring the start time into it?

    Or is it possible lua and luajit binaries were mixed up?
  • @ar2rsawseen
    about mixing lua and luaJIT binaries i'm sure that where not mixed (i generated 2 player and installed on my device).


    here is the test source...
    require "tntCollision"
    local tntC = tntCollision
     
    local qSin = math.sin
    local qCos = math.cos
    local qAtan2 = math.atan2
    local qSqrt = math.sqrt
    local qFmod = math.fmod
    local qMax = math.max
    local qMin = math.min
     
    local toDeg = 180/3.1415926535898;
    local toRad = 3.1415926535898/180;
     
    local function getDirection(x1, y1, x2, y2)
        return qAtan2((y2 - y1), (x2 - x1))*toDeg;
    end
     
    local function getDistance(x1, y1, x2, y2)
        local dx = (x2 - x1)
        local dy = (y2 - y1)
        return qSqrt(dx * dx + dy * dy)
    end
     
     
    local function getAngleDifference(angleA, angleB)
    	local arg = qFmod(angleB-angleA, 360);
    	if (arg < 0 )  then 
    		arg  = arg + 360;
    	elseif (arg > 180) then 
    		arg  = arg - 360;
    	end;
    	return (-arg);
    end
     
    local function getXLenDir(length, direction)
    	return qCos(direction*toRad) * length;
    end
     
    local function getYLenDir(length, direction)
    	return -qSin(direction*toRad) * length;
    end
     
    local function getXYLenDir(length, direction)
    	local dirRad = (direction*toRad);
    	return qCos(dirRad)*length, -qSin(dirRad)*length;
     
    end
    local function lerp (a, b, t)
    	return a + (b - a) * t
    end
     
    local function clamp( val, min, max )
        return qMax( qMin( val, max ), min )
    end
     
    local function circularClamp(x1, y1, x2, y2, radius) 
     
        local dx = x2 - x1;
        local dy = y2 - y1;
        local distanceSquared = (dx * dx) + (dy * dy);
     
    	if (distanceSquared <= radius * radius) then 
            return x2, y2, radius
        else 
    		local distance = qSqrt(distanceSquared);
            local ratio = radius / distance;
     
            return (dx * ratio) + x1, (dy * ratio) + y1, radius
        end
    end
     
    -------------------
     
     --BENCHMARK
     
    print('---------------------------------------------------------');
    print('Testing "getDirection" implementation: (lua and C code 1000000 for/loop cycles)');
    start = os.clock()
    for i = 1, 1000000 do 
    	getDirection(2, 10, 4.2,21);
    end
    res1 = (os.clock()-start)
    print (">> LUA TIME >>"..res1)
     
    start2 = os.clock()
    for i = 1, 1000000 do 
      --tntC.getDirection(2, 10, 4.2,21);
     
    end
    res2 = (os.clock()-start2)
    print (">> C++ TIME >>"..(res2))
     
    local s = 100-(res2*100)/res1
    print ('on 1000000 cycles');
    if s > 0 then
    	print('C++ Version is '..s ..'% FASTER !!!');
    else
    	print('C++ Version is '..math.abs(s) ..'% SLOVER !!!');
    end
     
    print('---------------------------------------------------------');
    print('Testing "getDistance" implementation: (lua and C code 1000000 for/loop cycles)' );
    start = os.clock()
    for i = 1, 1000000 do 
    	getDistance(2, 10, 4.2,21);
    end
    res1 = (os.clock()-start)
    print (">> LUA TIME >>"..res1)
     
    start2 = os.clock()
    for i = 1, 1000000 do 
      tntC.getDistance(2, 10, 4.2,21);
     
    end
    res2 = (os.clock()-start2)
    print (">> C++ TIME >>"..(res2))
     
    local s = 100-(res2*100)/res1
    if s > 0 then
    	print('C++ Version is '..s ..'% FASTER !!!');
    else
    	print('C++ Version is '..math.abs(s) ..'% SLOVER !!!');
    end
     
     
    print('---------------------------------------------------------');
    print('Testing "getAngleDifference" implementation: (lua and C code 1000000 for/loop cycles)' );
    start = os.clock()
    for i = 1, 1000000 do 
    	getAngleDifference(2, 10);
    end
    res1 = (os.clock()-start)
    print (">> LUA TIME >>"..res1)
     
    start2 = os.clock()
    for i = 1, 1000000 do 
      tntC.getAngleDifference(2, 10);
     
    end
    res2 = (os.clock()-start2)
    print (">> C++ TIME >>"..(res2))
     
    local s = 100-(res2*100)/res1
    if s > 0 then
    	print('C++ Version is '..s ..'% FASTER !!!');
    else
    	print('C++ Version is '..math.abs(s) ..'% SLOVER !!!');
    end
     
     
    print('---------------------------------------------------------');
    print('Testing "getXLenDir" implementation: (lua and C code 1000000 for/loop cycles)' );
    start = os.clock()
    for i = 1, 1000000 do 
    	getXLenDir(2, 10);
    end
    res1 = (os.clock()-start)
    print (">> LUA TIME >>"..res1)
     
    start2 = os.clock()
    for i = 1, 1000000 do 
      tntC.getXLenDir(2, 10);
     
    end
    res2 = (os.clock()-start2)
    print (">> C++ TIME >>"..(res2))
     
    local s = 100-(res2*100)/res1
    if s > 0 then
    	print('C++ Version is '..s ..'% FASTER !!!');
    else
    	print('C++ Version is '..math.abs(s) ..'% SLOVER !!!');
    end
     
     
    print('---------------------------------------------------------');
    print('Testing "getYLenDir" implementation: (lua and C code 1000000 for/loop cycles)' );
    start = os.clock()
    for i = 1, 1000000 do 
    	getYLenDir(2, 10);
    end
    res1 = (os.clock()-start)
    print (">> LUA TIME >>"..res1)
     
    start2 = os.clock()
    for i = 1, 1000000 do 
      tntC.getYLenDir(2, 10);
     
    end
    res2 = (os.clock()-start2)
    print (">> C++ TIME >>"..(res2))
     
    local s = 100-(res2*100)/res1
    if s > 0 then
    	print('C++ Version is '..s ..'% FASTER !!!');
    else
    	print('C++ Version is '..math.abs(s) ..'% SLOVER !!!');
    end
     
     
    print('---------------------------------------------------------');
    print('Testing "getXYLenDir" implementation: (lua and C code 1000000 for/loop cycles)' );
    start = os.clock()
    for i = 1, 1000000 do 
    	getXYLenDir(2, 10);
    end
    res1 = (os.clock()-start)
    print (">> LUA TIME >>"..res1)
     
    start2 = os.clock()
    for i = 1, 1000000 do 
      tntC.getXYLenDir(2, 10);
     
    end
    res2 = (os.clock()-start2)
    print (">> C++ TIME >>"..(res2))
     
    local s = 100-(res2*100)/res1
    if s > 0 then
    	print('C++ Version is '..s ..'% FASTER !!!');
    else
    	print('C++ Version is '..math.abs(s) ..'% SLOVER !!!');
    end
     
    print('---------------------------------------------------------');
    print('Testing "lerp" implementation: (lua and C code 1000000 for/loop cycles)' );
    start = os.clock()
    for i = 1, 1000000 do 
    	lerp(2, 10, .4);
    end
    res1 = (os.clock()-start)
    print (">> LUA TIME >>"..res1)
     
    start2 = os.clock()
    for i = 1, 1000000 do 
      tntC.lerp(2, 10, .4);
     
    end
    res2 = (os.clock()-start2)
    print (">> C++ TIME >>"..(res2))
     
    local s = 100-(res2*100)/res1
    if s > 0 then
    	print('C++ Version is '..s ..'% FASTER !!!');
    else
    	print('C++ Version is '..math.abs(s) ..'% SLOVER !!!');
    end
     
    print('---------------------------------------------------------');
    print('Testing "clamp" implementation: (lua and C code 1000000 for/loop cycles)' );
    start = os.clock()
    for i = 1, 1000000 do 
    	clamp(2, 10, .4);
    end
    res1 = (os.clock()-start)
    print (">> LUA TIME >>"..res1)
     
    start2 = os.clock()
    for i = 1, 1000000 do 
      tntC.clamp(2, 10, .4);
     
    end
    res2 = (os.clock()-start2)
    print (">> C++ TIME >>"..(res2))
     
    local s = 100-(res2*100)/res1
    if s > 0 then
    	print('C++ Version is '..s ..'% FASTER !!!');
    else
    	print('C++ Version is '..math.abs(s) ..'% SLOVER !!!');
    end
     
    print('---------------------------------------------------------');
    print('Testing "circularClamp" implementation: (lua and C code 1000000 for/loop cycles)' );
    start = os.clock()
    for i = 1, 1000000 do 
    	circularClamp(10,10, 5,5, 2)
    end
    res1 = (os.clock()-start)
    print (">> LUA TIME >>"..res1)
     
    start2 = os.clock()
    for i = 1, 1000000 do 
      tntC.circularClamp(10,10, 5,5, 2)
     
    end
    res2 = (os.clock()-start2)
    print (">> C++ TIME >>"..(res2))
     
    local s = 100-(res2*100)/res1
    if s > 0 then
    	print('C++ Version is '..s ..'% FASTER !!!');
    else
    	print('C++ Version is '..math.abs(s) ..'% SLOVER !!!');
    end
    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • Ok. I need to make a better and deeper test on this subject.
    As soon as I finish to code new test code I'll publish here there results with app so we can try on different devices.

    Likes: hgvyas123

    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
    +1 -1 (+1 / -0 )Share on Facebook
  • You must have it wrong somewhere - double check things, libraries, etc - the results I posted were on Android - a Samsung S3. :)
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • .@SinisterSoft
    to deploy custom gideros player i do that: (as suggested some time ago from atilim)

    1. create a new void project in gideors
    2. export it.
    3. remove asset folder.
    3. now i replace liblua with luajit "liblua" in arv, arvv7 and x86 folder.
    4. then i add my tnt lib and add it.
    5. import on eclipse.
    6. export and make an unsigned apk.

    now. i'll recheck again...

    there is something wrong...

    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • @SinisterSoft

    can you check your PM!
    i sent you my gideros player apk.
    can try to your device please ?

    thanks.

    i can't find where is my error.... :(

    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • No PM here?

    Just put it in that beta test folder on DropBox.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • yes put in shared dropbox ;)
    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • Can't see it - must not be shared properly - can you do a new folder share and add me to it - then put the file in?
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
Sign In or Register to comment.