Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

write a faster DLL

mmchandanmmchandan Member Posts: 1
I wrote a DLL in assembly language and compile it with masm32.i wrote
function modules which takes some floating points as argument and after
deed some simple arithmatic operation like addition or multiplication
then return the result.i wrote same function module in c++ and compile
it by visual c++ 6.0 compiler to make DLL.i notice that the DLL compiled
by visual c++ is much more fast than the DLL wrote and compiled by masm32.but i thought the DLL written and compiled by masm32 would be much faster.how can i write faster DLL or win32 application software in assembly language?by the by, i want to use the DLL with our own 3d game engine and 3d game where time and fastness is a great factor.please help me to write fast DLL and softwares.

Comments

  • DariusDarius Member Posts: 1,666
    : I wrote a DLL in assembly language and compile it with masm32.i wrote
    : function modules which takes some floating points as argument and after
    : deed some simple arithmatic operation like addition or multiplication
    : then return the result.i wrote same function module in c++ and compile
    : it by visual c++ 6.0 compiler to make DLL.i notice that the DLL compiled
    : by visual c++ is much more fast than the DLL wrote and compiled by masm32.but i thought the DLL written and compiled by masm32 would be much faster.how can i write faster DLL or win32 application software in assembly language?by the by, i want to use the DLL with our own 3d game engine and 3d game where time and fastness is a great factor.please help me to write fast DLL and softwares.
    :

    I think you misunderstand why assembly is "faster and smaller." It's not that if you write your code in assembly it will, by very nature of being written assembly, be smaller and faster. When one says assembly is smaller and faster one usually means well-written or hand-optimized assembly. So you need to really know what you are doing to get fast assembly and you REALLY need to know what you are doing to out optimize an optimizing compiler.

    Now you shouldn't bother with optimizing yet anyways unless you already have working code. Otherwise you may stand a very good chance of optimizing code that doesn't need to be optimized. Instead, the code should be profiled to see where it needs to be optimized. (Though there are plenty of places you can take for granted, however sometimes you are surprised.)

    You should probably stick to a high-level language... period. This in part comes from the last two paragraphs and the next argument: the best optimizations are algorithmic (i.e. high-level). A) an optimizing compiler can make some pretty good code, b) you don't need EVERYTHING to be tight quick assembly and there is little reason to write assembly that will be exactly what a compiler would output, c) the best optimizations you'll find will be algorithmic (e.g. an ultra-tight linear search algorithm in asm isn't going to search a 4 billion element array faster than a sloppily written binary search in a high-level language.) After doing most of algorithmic optimizations and lower-level optimizations you can do in the language, chances are the program will already be fast enough.

    Finally, for you specific example, if you are writing 3d graphics code, then the best solution would be to move to OpenGL as it uses the hardware acceleration on your graphics card and you have very little chance beating that out with a software implementation and using the hardware acceleration features of your graphics card directly would be very limiting and would give you little.

    "We can't do nothing and think someone else will make it right."
    -Kyoto Now, Bad Religion

  • Shawn CarterShawn Carter Member Posts: 0

    ______ ( http://forcoder.org ) free ebooks and video tutorials about ( Perl, Python, Objective-C, Ruby, C#, MATLAB, C++, Java, Swift, PHP, R, PL/SQL, Assembly, JavaScript, C, Visual Basic .NET, Go, Scratch, Visual Basic, Delphi D, Kotlin, Scala, Awk, Apex, Prolog, VBScript, Lua, SAS, Rust, Clojure, LabVIEW, Julia, FoxPro, Ada, Logo, ML, Lisp, Transact-SQL, Bash, F#, Fortran, ABAP, Scheme, Crystal, COBOL, Dart, Hack, Erlang, Alice ) _________

Sign In or Register to comment.