function blitz3d is slow than call a dll function
Blitz3D Forums/Blitz3D Programming/function blitz3d is slow than call a dll function
| ||
yes is more slow i am surpraise, this is the code in dll // Sumar BBDECL int BBCALL sumarwithdll( int n ) { return n+1; } sumarwithdll%( n% ):"_sumarwithdll@4" and this code is the test ; pruebas de tiempo con las dlls Print "Pulse una tecla para empezar" WaitKey i = 0 nStart# = MilliSecs() For n = 0 To 20000000 i = sumarwithblitz3d( i ) ; (blitz3d) ;i = sumarwithdll( i ) ; (dll) Next nEnd# = (MilliSecs() -nStart#) /1000.0 Print "Ha tardado: " +nEnd# WaitKey ; this function is equeal at sumar of dll Function sumarwithblitz3d%( n% ) Return n% +1 End Function the result if you change (blitz3d) and (dll) is this with blitz3d elapse in seconds is 9.001 with dll eplase in seconds is 4.44 is very strange |
| ||
That's pretty interesting... I would've thought the dll calling overhead would have made a dll to do somthing so simple slower..... |
| ||
blitz3d is a script language or 100% pure code? in c++ the elapse time is 0.22 and if i call a dll 0.45, the dll is more slow i have a piii 1200 notebook if test the example |
| ||
Can this maybe be becource you using and INT in the Dll and a floart in the blitzcode? :-p try removing the "%" and then see. |
| ||
this simbol % is for integers, the # simbol is for float ;) but i tested and the elpase time is equal, i tested too with # and the elapse time up 0.5 is more very strange jeje |
| ||
% is int, # is float |
| ||
Sorry my bad :-D But try it anyway :-P |
| ||
Sounds dodgy. I did a similar test awhile back, but using a squared distance function in c++, and a blitz custom function. Results were near identical every time, vc6++ was no faster. Though if I did the actual loop in C++ that's another story. |
| ||
i no compare c++ and blitz3d, i compare call function of blitz3d and call function dll from blitz3d and the dll is more speed than blitz3d function, i started test when i created dibLib.dll beacuse i need very speed for tree library i maked |
| ||
you can use a Gosub routine (Sorry for swearing) |
| ||
Which works great unless you want to pass arguments. Or get a return value. Or do anything useful... |
| ||
for me the call a function is very important, the test is beacuse i make a dll and i need speed with call functions with dll but i see what the dll is very good and no slow down the speed, up the speed ;) blitz3d is good but time at time for very good :) |
| ||
neomancer with gosub work fantastic, equal what inline function |
| ||
i am a stupid i test in debug mode, in release mode is very very speed 0.49 :) |
| ||
Speaking of inlines, I wrote a preprocessor that handles inlines (amongst other things). Anyone else doing much with preprocessors and Blitz? Seems to me we can fix a lot of the things Blitz is missing with a preprocessor. For example: - explicit variable declarations - inlines - variable code compilation - macros - generating decls - maybe code generation for function pointers... I've got some of the above working. Unfortunately, having to dump the stuff out to a temp file and compile that kinda sucks when you're using an IDE. It would be much better if we could convince Mark to add some of these features directly. |
| ||
I think Mark might be a 'lil bit busy at the mo. I'm betting B3D preprocessors/IDEs are the last thing on his mind. :P Doesn't Protean offer many of the features you mention, anyway? |
| ||
a function pointers is very important, i am write apps in c++ i am use this pointers for find items, states, etc in the dibLib.dll i make a trees but i cant view all items from blitz3d because havent pointer functions, in the c++ class is posible, if you see the code of class tree you download here http://www.davidib.com/codigosfuente/dibTree.rar in the http://www.davidib.com/codigosfuente/ you can see more codes |
| ||
Speaking of inlines, I wrote a preprocessor that handles inlines (amongst other things). Anyone else doing much with preprocessors and Blitz? Seems to me we can fix a lot of the things Blitz is missing with a preprocessor. Wow! Someone else! :) |
| ||
Inlines are a feature for optimizing performance which most Blitz programmers probably don't need (although it's nice to have). I shouldn't think it's an enormous priority, and in any case several IDE developers have support for it. Function pointers are primarily useful if you don't have real object support (C++ has both, of course, but then C++ tends to have a hundred ways to do any thing)... which BMax will have. |
| ||
i wait for bmax i read commets and is a great languaje, the editor of bmax are maked with bmax :), is this good beacuse bmax have standard controls and events of windows, i hope what bmax are equal c++ or java when it leaves on sale? |