thelowlyone Posted December 13, 2006 Posted December 13, 2006 I keep hearing that programs written in assembly uses less resources. For example, I often hear that Nod32 is written completely in assembly and therefore has lower memory usage and gives it faster scanning speeds than other AVs. I thought that all programming languages compiles to assembler or machine language. If so, can someone explain to me why programs written in assembly language is more "efficient" than say a program written in C++? Or at least point me to a resource. Thanks in advance. Quote
boristsr Posted December 13, 2006 Posted December 13, 2006 they CAN be more efficient, in regards to performance IF the programmer knows assembly well. an average programmer who learns assembly will more than likely be beaten by a good optimizing c compiler. i highly doubt nod32 is written entirely in assembly because assembly is such a bitch of a language to work with on large scale projects. the code is not clear and it takes a lot of code to do simple things. in general your development speed would be MUCH quicker when using a higher level language and the program will be much easier to maintain. the only times to use assembly is: *you are working on a system that has an assembler but no other compiler *you have profiled your code, performed heavy algorithm optimizations and you still need less memory usage and/or faster code. you will find assembly does not outperform c/c++ enough to justify rise in development time and costs. i find it hard to believe any modern program is written entirely in assembly, i do however know a fair few programs have portions of them written in assembly. Quote
jool Posted December 13, 2006 Posted December 13, 2006 It isn't that simple. They can use less resources but it is not a guarantee you get just by writing it in assembler. Many compilers converts code into assembler and then hands that to a program that turns that into runnable code. The difference between things coded directly in assembler and higher level languages is the optimization. Compilers optimize the code they generate but there is a limit, the assembly code generated from the higher level language needs to still be an accurate representation of the code to be sure it gets the right result. With the knowledge of what needs to be accomplished the skilled assembly coder could possibly write better optimized code that isn't possible to write in a higher level language that still gets the same result while using only the bare minimum of resources. Most of the time it is just isn't worth the effort though since modern optimizers are very good and modern processors are very complex. This means that you would need to be very skilled at coding and knowledgeable about the structure of the specific processor to write code better optimized than the code a good compiler would generate. Even if you could you would still be wasting a lot of time for little gain just to show how big your e-penis is. Edit: Note to self, going to eat lunch before clicking submit makes people respond before you. Quote
thelowlyone Posted December 13, 2006 Author Posted December 13, 2006 Thanks for clarifying this for me. boristsr, I checked on wikipedia and it says that Nod32 is written entirely in assembly :? but whatever. We all know that wikipedia is the most accurate source of info Quote
cooper Posted December 13, 2006 Posted December 13, 2006 The scanning engine very well may be. But most of the program probably isn't because of the extra effort involved. This is why ASM programming today is a dying art: It's often more cost-effective to throw more hardware at the problem than it is to get some ASM genius to optimize the living crap out of the core of the application. Quote
rFayjW98ciLoNQLDZmFRKD Posted December 13, 2006 Posted December 13, 2006 Edit:Note to self, going to eat lunch before clicking submit makes people respond before you. lawl! It's all about how the programmer wrote the code, not the language it was written in. I good program written in basic can out perform a bad one in assembly. Quote
metatron Posted December 20, 2006 Posted December 20, 2006 Edit: Note to self, going to eat lunch before clicking submit makes people respond before you. lawl! It's all about how the programmer wrote the code, not the language it was written in. I good program written in basic can out perform a bad one in assembly. ASM is worth learning, even if your shit, it is always useful to have an understand as if you ever work with people like me, they will expect you to at least have an understanding. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.