Slashdot Mirror


TIOBE's Language-Popularity Index Sees A New Top 10 Language: Assembly (tiobe.com)

TIOBE's "Programming Community Index" measures the popularity of languages by the number of skilled engineers, courses, and third-party vendors. Their July report indicates that Assembly has become one of the 10 most popular languages: It might come as surprise that the lowest level programming language that exists has re-entered the TIOBE index top 10. Why would anyone write code at such a low level, being far less productive if compared to using any other programming language and being vulnerable to all kinds of programming mistakes? The only reasonable explanation for this is that the number of very small devices that are only able to run assembly code is increasing. Even your toothbrush or coffee machine are running assembly code nowadays. Another reason for adoption is performance. If performance is key, nobody can beat assembly code.
The report also noted that CFML (ColdFusion) jumped from #102 to #66, Maple from #94 to #74, and Tcl from #65 to #48. But Java still remains the #1 most-popular language, with C and C++ still holding the #2 and #3 positions. Over the last five years, C# and Python have risen into the #4 and #5 spots (made possible by PHP's drop to the #6 position) while JavaScript now holds the #7 position (up from #9 in 2011). Visual Basic .NET came in at #8, and Perl at #9.

20 of 348 comments (clear)

  1. Not convinced by LinuxInDallas · · Score: 4, Informative

    I've been involved in firmware development for implantable medical devices as well as other devices and it's simply not true that assembly has much use this day in age. Unless you are coding for one of the small memory footprint AVR or PIC devices you are not going to get better results working in assembly.

    1. Re:Not convinced by Austerity+Empowers · · Score: 4, Interesting

      There are good reasons to work in assembly, particularly in systems programming. Or if you don't want to pay licensing fees for an OS, you may need to implement functions in assembly that are not possible in a high level language like C (manipulating machine state registers, implementing barriers, etc.).

      I have been using assembly for various architectures for my entire career and most of my teenage life, I don't see any reason why it would ever go away. Mostly the number of people doing high level development has increased so radically that it honestly surprises me that it makes #10. Optimization for performance is definitely not a reason I'd expect to see asm hit #10 - most companies don't spend enough time on their applications to get to the point where they can optimize intelligently, and writing something in assembly is not always or a performance enhancer.

    2. Re:Not convinced by geoskd · · Score: 3, Interesting

      Then I assume you're paying a third party to supply libraries for you, operating systems, startup code, BSPs, etc. Which means those third parties are using the assembler even if you aren't. I do embedded for a living, and I have to do assembler - not everyone working on the software does but some people do.

      As a contractor, I have seen a large number of projects where the client wanted optimizations done for both space and performance so they could try to squeeze one more feature into an already barely capable processor. In all but one of those cases, it turned out to be more cost efficient to replace the microcontroller with a more modern one. In about a third of the cases, my solutions actually *reduced* unit cost because the client had been paying a higher per unit price for their uCs than what is currently available for much more powerful options. The most extreme example was stripping an old Freescale processor out of a product and replacing it with a modern cypress PSOC. The old processor cost $11.03 per unit, and the PSOC cost $1.57. The per unit savings paid for my contract cost in less that 2 years (including the new features they wanted). It almost never makes sense to resort to assembly unless there is a reasonable expectation of selling millions of units per year, and even then, it'll be close because powerful uCs have become so damn cheap lately. I can do it if thats what the customer really wants, but my job is to maximize the customers return on their investment in my time. I do very well because my customers get what they really want, not necessarily what they initially come to me asking for.

      If you're out of compute power, your best bet is to look into getting a faster uC, or getting a PSOC, where you can offload a significant portion of your compute expense into programmable hardware.

      --
      I wish I had a good sig, but all the good ones are copyrighted
    3. Re:Not convinced by gweihir · · Score: 4, Insightful

      There are also some pretty stupid limitations in C, for example, no access to the "carry" bit. Usually it does not matter, but if it does, embedding assembler is the way to deal with that.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
  2. Assembly language for what machine? by jfdavis668 · · Score: 4, Insightful

    They are machine dependent.

  3. Assembly for what processor architecture? by slowdeath · · Score: 4, Insightful

    X86, ARM, AVR, IBM360, PDP8, or what? Just saying 'assembly' is not all that interesting. Processor architecture(s) would be interesting to know.

  4. Ahem by kackle · · Score: 5, Insightful

    "Why would anyone write code at such a low level, being far less productive if compared to using any other programming language and being vulnerable to all kinds of programming mistakes?"

    A) Why don't you ask them and learn?

    B) I politely disagree that they are automatically "far less productive". I am an embedded programmer and have only used tiny amounts of assembly over the last decade. However, if I had more tiny projects, and my bosses weren't akin to cats chasing flashlight spots to where I could stick with the same processor for more than a year, I'd consider it for sure. Why? Because I never seem to get to just "code and go" anymore. As an example, last week I had to reinstall my multi-gigabyte Eclipse IDE for the SECOND time this past year (this time due to a debugger corruption). In such IDEs, all the higher libraries (and their paths) need to be in place, and compiled too (which doesn't always go perfectly). Whereas my former officemate would open any text editor (his was Corel Word Perfect(!)) to write his assembly, then compile on the command line, then upload the binary.

    I don't know how many hours I've spent learning and fixing IDEs. Then, a year to two later, the IDE changes again after the chip's OEM "upgraded" it! ...More productivity down the drain.

  5. Re:Surprise? Why? by Darinbob · · Score: 5, Insightful

    There's more than one reason to want optimization. There's optimizing for speed in a full algorithm, in which case assembler isn't that important. But optimizing for speed in localized locations can be very important. Ie, the faster your interrupt handlers are the better I/O throughput you can get, or faster context switches, etc. If you're programming on a DSP for instance, you almost always want the best speed and that often means assembler or assembler wrapped inside of macros or special directives. There's also optimization for size, and occasionally assembler helps there as well to cram in as much as you can in the limited space.

    And of course you need to *know* assembler even if you don't write it. It's how you decode core dumps, figure out what your code is doing, and lets you treat the machine as more than a black box (I've seen people with efficient algorithms that weren't so fast because they didn't understand what was fast or slow under the hood).

  6. Compiling toothbrush code with GCC by Guy+Harris · · Score: 4, Informative

    Here's a electric toothbrush reference design from Texas Instruments.

    Here's the MSP430G22x0 microcontroller used in the design.

    Here's a list of software tools for that microcontroller. The list includes something called "GCC", which they say is an "Open Source Compiler for MSP Microcontrollers".

    Here's a page from Renesas about electric toothbrush designs.

    Here's a list of software tools for Renesas processors; they list C compilers for the R8C and RL78 microcontrollers, as mentioned in the previous page.

    So don't assume all the code in your toothbrush was written in assembler language; some of it may have been written in C, although some of the low-level library routines might be written in assembler (or an asm in the C code).

  7. Re:Surprise? Why? by Anonymous+Brave+Guy · · Score: 5, Informative

    That hasn't really been true for a long time, unless your hand-written assembly code will reliably outperform a good compiler's generated code.

    Hint: It's a reasonably safe bet that it won't, unless you actually are a world-class expert on the subject, such as the people who write those compilers.

    Modern CPUs are not the chips your grandpa programmed. They are full of caches, pipelines, predictive execution, parallel operations, and numerous other confounding factors that mean what you think will run fast and what will actually run fast may be two wildly different things, even in apparently simple cases.

    Whole teams of very smart people spend years reading and understanding thousands of pages of CPU specs so they can write compilers that analyse and optimize code at the speed of those modern CPUs to generate efficient machine code from it. Even if you can beat them on implementing one simple algorithm in isolation because you can spot something the compiler missed, modern high level languages encode so much more programmer intent than raw assembly that you might still lose out overall because you're disrupting larger-scale optimisations.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  8. Re:Surprise? Why? by Anonymous Coward · · Score: 5, Informative

    I write compilers for a living, and I came in to say something much like the above.

    I have direct experience recoding moderate sized C++ functions in hand-coded assembly. I have been able to beat the C++ compiler, but... not easily, and not without major elbow grease and lots of my time. It's most often not an easy thing to do, because the compiler has sophisticated scheduling and optimization algorithms, and because of the hardware complexity the parent post is talking about. Most programmers weaned on Java don't quite grasp the performance complexity that exists in modern CPUs.

    Does it ever make sense to write asm directly? Once in a while, yes, but in the vast majority of cases, optimization time is better spent at the C++ level improving the time complexity of algorithms that dominate the problem space, or perhaps recoding Java into C++. Outside of very specialized and rare circumstances, I don't find reasons to optimize below the C++ level.

    There are highly constrained devices where directly coding asm is the way to go, but fewer and fewer all the time.

  9. Re: Surprise? Why? by WarJolt · · Score: 4, Insightful

    People suck at macro optimizations in assembly. If your assembly program is more than 25 instructions, you're probably not going to do a better job than a compiler.

    If you're writing intel code you'll probably see better speedup using c++17 parallel policies or some other parallelization framework, but sometimes it is necessary to optimize small segments of code. Premature optimization is the root of all evil and effective use of templates and metaprogramming can go a long way without much effort. Embedded devices should be treated to same way. Write a high level implementation in the highest level language available to you and hand optimize only when necessary.

    I've compared c++ stl implementation of algorithms to c implementations and my c++ almost always runs faster with significantly less code. Small programs that calculate trivial results are always faster in low level languages, but real programs need complicated structures and its almost always infeasible to hand optimize those effectively.

  10. Re:Surprise? Why? by K.+S.+Kyosuke · · Score: 3, Informative

    In the day of viable superoptimizers or superoptimizer-generated peephole optimizers and viable evolutionary/exploratory/search-based compilers, you should need to know assembly even less than ever before. Remember, the machine can try out new things both faster than you and cheaper than you.

    --
    Ezekiel 23:20
  11. Re:Surprise? Why? by Boronx · · Score: 4, Interesting

    There are a lot of processors out there that aren't complicated. On an 8 bit microcontroller with an instruction set size of only a few dozen, it's not hard to beat compiled code.

  12. Re:Surprise? Why? by Opportunist · · Score: 4, Interesting

    Counter-intuitive as it may seem at first, the smaller your instruction set, the higher the chance that the compiler is actually better at optimizing than you are, unless you have a LOT of experience writing and optimizing assembler code. Mostly because the smaller the set, the longer the code gets and the more you have to take into account certain side effects from instructions. I spent quite a few hours puzzling why the compiler would completely rearrange the instructions only to notice that it gained a bit of an advantage from creative pipeline restructuring and carefully manipulating certain jumps.

    The only area where humans outperform compilers reliably is conditional jumps. Because humans can usually more readily tell from the intended program flow which branch is more likely to be executed and can optimize the programs in that way. Hand that information to the compiler and I hold any bet that it will outperform you any day.

    --
    We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
  13. Re:Surprise? Why? by gweihir · · Score: 4, Insightful

    If you do not know assembly, you cannot be a really good coder and you cannot even understand how common attacks on code work these days or why some things run much slower than others. That said, actually coding in assembly is something you only do when there are very good reasons to and mostly as assembly embedded in C.

    --
    Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
  14. Re:Surprise? Why? by Rockoon · · Score: 4, Interesting

    They are full of caches, pipelines, predictive execution, parallel operations, and numerous other confounding factors

    You are using all the same arguments C/C++ programmers used in 1995 but if the discussions wasnt about assembly language but instead the discussion was a comparison of compilers from 1995 with compilers from 2015 you would be telling us how terrible those 1995 compilers were at optimization even then.

    The fact is that it doesnt require an expert to beat a compiler at optimization. The fact is that your idea of an "average assembly language programmer" is actually a terrible assembly language programmer. When you dont consider someone that learned C/C++ a month ago an average C/C++ programmer, why do you then consider someone thats literally never actually taken assembly serious as the benchmark average?

    ..and if you are "confounded" by caches, pipelines, superscaler techniques, and so on ("cause surprise or confusion in (someone), especially by acting against their expectations.") then its because you are ignorant of the architecture. Your ignorance doesnt define reality.

    Recently a programmer undertook the task of converting the strongest open source chess engine (stockfish) to 80x86 assembly language. He still has done no optimization. He has literally just done a straight simple conversion and its already 10%...20% faster and is now easily beating the C++ compiler version in tournaments.

    ..and notice how its now 10% faster... or 20% faster... there is a range because it depends which gcc compiler version is used (older versions produce better code.) If gcc has such a large variance in performance, if newer versions are slower, then what are we to think of the veracity of your claims? I'll tell you what: they arent veracious claims. They are wishful thinking.

    --
    "His name was James Damore."
  15. Horsecrap by Giant+Electronic+Bra · · Score: 4, Informative

    You may be right for some VERY small and trivial applications, but sometime in the early 90's optimizing C compilers FAR outstripped hand-coded assembly for any larger project. These days it isn't even a contest. A good optimizing compiler like the Intel C/C++ compiler can crank out code that is anywhere from 3 to 10 times faster than what you can do by hand. I should know, I did PLENTY of Assembly, and worked with some LARGE assembly-language applications back in the 80's. ALL of them were totally rewritten in C before 1995, and I'm talking about RTOS kernels and stuff, things where one clock cycle matters. There may be some few very specific 'inner loop' interrupt handling logic and such that is still written in assembler, mostly because that sort of code is idiosyncratic and can't really be safely optimized, but we're talking a very few lines of code, maybe 500 out of 500k SLOC.

    I can buy the idea that there are 'IoC' things out there with extremely minimal processing power, basically little 8 bit devices with a few K bytes of RAM and Khz CPU clocks that you really CANNOT code in an HLL. Of course the amount of code that you write for that thing is obviously also extremely minimal. We're talking "blast this fixed length 802.11 frame out there every 2 seconds with these 12 bytes holding the RAW bit values from the ADC and the 3 discretes to a broadcast address" kind of thing.

    --
    "Malo periculosam, libertatem quam quietam servitutem." -- Jefferson
  16. It's not rocket science! by Xenna · · Score: 3, Interesting

    Perhaps THOBE is mistaking the fact the NASA put up the full assembly code for the Apollo 11 guidance computer on Github and the interest in that (6000+ stars) for a revival of the language instead of a historical artefact.

    Check it out here and don't forget to start it, together we can confuse THOBE and make Assembly the #1 language of the world again! ;-)

    https://github.com/chrislgarry...

  17. Assembler is good for certain things by Casandro · · Score: 3, Interesting

    First of all, many, if not most, computers run software so trivial on microcomputers so small, installing a compiler for them would just be _way_ more effort than to just code to program in C. Typical examples are the microcontrollers in electric toothbrushes or other smaller embedded systems. It's hard to get your software running on a 4 bit microcontroller as modern C makes assumptions like having your memory addressible at a byte level.

    Then there is another, in my opinion more important, point. Assembler is a great teaching aid. It shows you what the computer actually does. Understanding things like pointers is trivial in Assembler so you can learn a lot from it. Also in Assembler every control structure hurts, as you need to keep track of it yourself. This nudges you towards writing simpler code, away from thousands of nested if statements and functions with hundreds of lines. Those are desirable traits in all programming languages.

    No language is suitable for everything, but most languages have at least one are where they are really useful.