Page 1 of 18 12311 ... LastLast
Results 1 to 10 of 177

Thread: Is Assembly Still Relevant To Most Linux Software?

  1. #1
    Join Date
    Jan 2007
    Posts
    14,302

    Default Is Assembly Still Relevant To Most Linux Software?

    Phoronix: Is Assembly Still Relevant To Most Linux Software?

    Steve McIntyre and the Linaro Enterprise Group recently analyzed Ubuntu and Fedora software packages to see what software was still relying upon hand-written Assembly code. This was done to see how much real Assembly is being used, to see what the code was used for, and whether it was worth porting to 64-bit ARM / AArch64 / ARMv8...

    http://www.phoronix.com/vr.php?view=MTM0MDk

  2. #2
    Join Date
    Dec 2009
    Location
    Greece
    Posts
    351

    Default Assembly is overrated...

    This is not surprising at all. There is a myth that programming in assembly produces faster executable code, but this is not always the case. It enterily depends on the programmer's ability. Many times a compiler produces better executables than hand written assembly, and is less prone to errors, not to mention developing in assembly takes ages...

    There is absolutely no point in using it today, except for corner cases.

    In fact, we are rapidly approaching an age where almost all programs will be written in managed languages like Java and C#. Virtual machines have come a long way in speed, and with multicores now the norm, managed code can be as fast or sometimes even more than unmanaged code.

  3. #3
    Join Date
    Dec 2012
    Posts
    500

    Default

    Quote Originally Posted by TemplarGR View Post
    This is not surprising at all. There is a myth that programming in assembly produces faster executable code, but this is not always the case. It enterily depends on the programmer's ability. Many times a compiler produces better executables than hand written assembly, and is less prone to errors, not to mention developing in assembly takes ages...

    There is absolutely no point in using it today, except for corner cases.

    In fact, we are rapidly approaching an age where almost all programs will be written in managed languages like Java and C#. Virtual machines have come a long way in speed, and with multicores now the norm, managed code can be as fast or sometimes even more than unmanaged code.
    What? This isn't about managed vs unmanaged, and if anything the Linux development space is trending towards Qt, which is C++ and native, since Java is a slow boring piece of crap, and C# (mainly Xamarin) has been disowning the Linux developer scene hardcore. Neither are supported across mobile platforms either, which is key, and something that Qt actually has going for it as well, and as GTK and Gnome get its act together it remains a competitor. Maybe language binds for native toolkits, like pyside, but even that won't support mobile platforms like native will.

    I'm honestly surprised 6% of packages have assembly. I mean, that is slightly more than 1 in 20 packages using assembly. When you factor in how many of those are written in Python / Java / C# / etc, you know, the managed languages, it means a quantifiable number of C/C++ packages use platform dependent hand written assembly still.

  4. #4
    Join Date
    Nov 2011
    Posts
    10

    Default

    I'm actually kind of tired of reading comments from people regurgitating how "it is a myth that coding assembly produces faster code" or that it is overrated. These people obviously have no clue what they are talking about.

    One "problem" with writing software in assembly is that you end up doing quite a few high-level function calls so the question ends up with; how much is low-level assembly really when most of the execution time of the program takes place in libraries (that most likely are not coded in assembly) rather than the program itself.

    A person who decides to write particular routines in assembly knows what he is doing and in most cases hand-written code will be more optimized than code that is compiled from high-level. Sure, some cases may be debatable and you might find that e.g. Intel's c compiler sometimes generates really good code that is close to what one would have achieved with hand-written assembly.

    But still in general, an experienced assembly programmer writes more optimized code than any high-level compiler in existence.

  5. #5
    Join Date
    Feb 2011
    Posts
    1,066

    Default

    Quote Originally Posted by axero View Post
    But still in general, an experienced assembly programmer writes more optimized code than any high-level compiler in existence.
    If you are responding to TemplarGR, I think you are saying the same thing. TemplarGR said, "but this is not always the case. It enterily depends on the programmer's ability." (emphasis added)

  6. #6
    Join Date
    Sep 2012
    Posts
    277

    Default SIMD, kernel

    AFAIK compilers don't produce optimized assembly using SIMD instructions, which is the only "corner case" that comes to my mind for using assembly along with writing kernel code that directly interfaces with the hardware.

  7. #7
    Join Date
    Mar 2013
    Posts
    14

    Default

    It's partially true that it's up to the programmer's skill on how small and fast he can make his code. But there's different limits for each programming language and assembly is the one you can make your executable most fastest and/or smallest possible compared to C, C++, java etc. because you are given more control over how memory is managed.

    But because of advances in CPU power, such refinements and sleekness are not needed for most apps you use today. However, part of the Linux kernel is still in assembly while the rest is in C. So assembly is still important but not used as much. There's still however, one use of assembly in "Applications". Creating Worms and Viruses. These things need to be slick and small enough to easily get on computers. They need to manage memory properly and efficiently as well to stay hidden to such a point that only assembly provides the means to produce a program which achieves that.

    So if you're a malicious cracker (and all crackers use Linux because they would have learned that Linux is the safest), assembly and assemblers like nasm are still relevant to you for creating viruses to infect Windows and BSD machines.

    BSDs are so insecurity that you probability only need to write your code in C, C++ or even shell to be successful.

  8. #8
    Join Date
    Mar 2013
    Posts
    14

    Default

    It's partially true that it's up to the programmer's skill on how small and fast he can make his code. But there's different limits for each programming language and assembly is the one you can make your executable most fastest and/or smallest possible compared to C, C++, java etc. because you are given more control over how memory is managed.

    But because of advances in CPU power, such refinements and sleekness are not needed for most apps you use today. However, part of the Linux kernel is still in assembly while the rest is in C. So assembly is still important but not used as much. There's still however, one use of assembly in "Applications". Creating Worms and Viruses. These things need to be slick and small enough to easily get on computers. They need to manage memory properly and efficiently as well to stay hidden to such a point that only assembly provides the means to produce a program which achieves that.

    So if you're a malicious cracker (and all crackers use Linux because they would have learned that Linux is the safest), assembly and assemblers like nasm are still relevant to you for creating viruses to infect Windows and BSD machines.

    BSDs are so insecurity that you probability only need to write your code in C, C++ or even shell to be successful.

  9. #9
    Join Date
    Jan 2013
    Posts
    12

    Default

    Linux kernel, some assembly required :P

  10. #10
    Join Date
    Mar 2011
    Posts
    326

    Default

    Saying hand optimized asm isn't faster than any lang is flat out bullshit, negating stack pushes (values as well as sp's), redundant/unnecessary register stores and swaps, jump zero flags instead of cmp's,etc...

    Now is it necessary (other than CPU probing and other hardware)? I stopped writing in ASM ~2002 for a reason. Still I am glad that you can insert _asm into a c project... too bad it's AT&T (yeah I know you can flag it to Intel) syntax.

    Edit: man was it fun stuffing all the code in the .data section for obfuscation. Too bad anti viruses flagged the crap out those programs.
    Last edited by nightmarex; 04-02-2013 at 07:58 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •