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.

37 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.
    4. Re:Not convinced by Darinbob · · Score: 2

      And optimizers are sometimes stupid. Ie, you do the equivalent of rotate and such and it doesn't figure out to replace with a single instruction. Don't always need it, but is handy for optimizing crypto type stuff.

  2. Re:Surprise? Why? by drinkypoo · · Score: 2

    If you want speed, assembly is the ONLY option.

    But virtually all of the optimization happens in virtually none of the code, I always forget the percentages but they are probably made up anyway. You will need some ASM. I think it's more credible that more people are writing some ASM for some parts of some projects. It's not unreasonable to imagine that the ongoing proliferation of embedded doodads would spur that on, but it's a stretch to imagine that it's for devices for which there is nothing but an assembler.

    --
    "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
  3. Assembly language for what machine? by jfdavis668 · · Score: 4, Insightful

    They are machine dependent.

  4. 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.

  5. Re:wat by slowdeath · · Score: 2

    Do you understand what 'programmed' in assembly means? Does not mean there is an assembler or interpreter on the device, only that the source code was written in assembler for some processor architecture, assembled to a binary image, and then programmed into ROM/FLASH/etc on the target device.

    'Programmed in C' does not mean your fancy toothbrush has to have GCC running on it to be able to do its thing any more than 'programmed in assembler' does.

  6. 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.

    1. Re:Ahem by MillionthMonkey · · Score: 2

      I always write assembly because it's easier to read than Perl.

  7. 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).

  8. 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).

    1. Re:Compiling toothbrush code with GCC by ColdWetDog · · Score: 2

      According to TFA, the electric toothbrush reference design is also suitable for 'personal care items'.

      Never in a thousand years would I have thought such a stodgy outfit as TI would have ever created a reference design for a vibrator.

      Not to mention the sad state of affairs when said vibrator needs a microprocessor. Now you have no idea with the thing is really doing when you turn it on. This is a really fucking weird world.

      --
      Faster! Faster! Faster would be better!
  9. 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.
  10. 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.

  11. 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.

  12. 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
  13. 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.

  14. 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.
  15. Re:wat by Opportunist · · Score: 2

    I prefer to do smaller Cs in Assembler. In real time systems it can be important to know EXACTLY how many cycles an set of instructions will take. You can also carefully craft a routine to have exactly the same run times no matter the branch it takes, which can be very important in areas where reliable timing is key (e.g. if you want to avoid that your encryption get broken by a timing attack, or when you're dealing with crap like the USB protocol which barfs the moment you're just a liiiiittle bit off).

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

    There was a very good op-ed from the Usenet days which pointed out that an assembly programmer will always beat a high-level-language programmer on most performance metrics because a typical assembly programmer can use a compiler but a typical high-level-language programmer can't use an assembler.

    An assembly programmer can use a profiler to work out where the problems are, inspect the output of the compiler, see what's wrong with it, and fix it using assembly. (Today we might include intrinsics as a potential fix, of course.) Assembly programmers write faster code because they can also use a compiler.

    --
    sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
  17. 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.
  18. 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."
  19. 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
  20. Re: Surprise? Why? by Anonymous Coward · · Score: 2, Informative

    Take a look at OpenSSL some day cowboy.

    Generally the asm paths are at least 3x the speed of the code the best compilers can generate.

    When the speed up for using asm on Itanium was 5x was when I realized it was doomed. The compilers were further from human performance than on the older architecture and that wasn't going to improve.

     

  21. Re: Surprise? Why? by Darinbob · · Score: 2

    Basically the code and vars won't fit in the chip I have at the moment without finding weird ways to save space. So there are times when changing something in assembler can save a couple hundred bytes. There's also parts of the code even more constrained in size, like a bootloader that has to fit in 4k, so optimizing there is worth it.

  22. Re:If performance is key... by Rockoon · · Score: 2

    I wanna see a human beat any modern-day compiler to optimizations.

    asmfish

    10% to 20% faster than the C++ version.

    The authors of the c++ version have attributed the speed gains to better register usage. The author of this asm version says he hasnt actually started optimizing yet.

    You C++ programmers are delusional.

    --
    "His name was James Damore."
  23. Re:Surprise? Why? by Rockoon · · Score: 2

    And this guy specializes in testing the strength of stockfish as it evolves:

    http://spcc.beepworld.de/

    Note how he included a june build of asmfish, and that asmfish is leading even against july builds of stockfish.

    Which "metric" should we use?

    Nodes per second? asmfish is faster than stockfish.
    Time to depth? asmfish is better than stockfish.
    Playing strength? asmfish is better than stockfish.

    I wonder what metric this guy is going to want to use that retains his wishful thinking of C++ supremacy. Maybe the number of lines of code?

    --
    "His name was James Damore."
  24. Re:PFFT! Assembly is NOT low level! by fustakrakich · · Score: 2

    01010011 01110100 01110010 01100001 01101001 01100111 01101000 01110100 00100000 01110101 01110000 00100000 01100010 01101001 01101110 01100001 01110010 01111001 00100000 01101001 01110011 00100000 01110111 01101000 01100101 01110010 01100101 00100000 01110100 01101000 01100101 00100000 01100001 01100011 01110100 01101001 01101111 01101110 00100000 01101001 01110011 00101110 00100000 01000101 01110110 01100101 01110010 01111001 01110100 01101000 01101001 01101110 01100111 00100000 01100101 01101100 01110011 01100101 00100000 01101001 01110011 00100000 01110011 01100001 01101100 01100001 01100100 00100000 01100100 01110010 01100101 01110011 01110011 01101001 01101110 01100111 00101110 00101110 00101110

    The Slashdot filtering system prevents posting this without ASCII fluff that you are free to ignore...

    --
    “He’s not deformed, he’s just drunk!”
  25. Re:cc65 doesn't optimize much by Roger+W+Moore · · Score: 2

    There is another reason: the 6502 assembler is relatively easy to program (I was doing it at ~13-14) and you get a very significant performance boost. Modern CPUs have complex pipelined architectures and for efficient, fast execution modern assembly requires hints etc. so the CPU can make effective use of pipelines etc. This makes it far, far harder.

    Even with a CPU as old as DEC's Alpha back in the late 1990's I was astounded when DEC's C++ compiler produced faster code than I could with basic assembly. Once I saw the hints it added I was able to up my game and beat it slightly but the speed gain was nothing like as impressive as it was for the 6502 based BBC Model B plus it required far more effort e.g. knowledge of the CPU architecture etc.

  26. Toothbrush? Coffee Machine? by angel'o'sphere · · Score: 2

    My 300Euro coffee machine runs no code at all.
    Neither does my plastic tooth brush.

    And by the way: Assembly is not a language. 68k Assembly might be one assembly language. x86 another one. Both have not much in common.

    --
    Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  27. Re: Surprise? Why? by Shinobi · · Score: 2

    One benefit of hard resetting a stack, register or even a variable after each use is that it is a step towards making your code more deterministic, by setting it to a known safe state.

    For some of the driver code I develop, the ability to do that in a strict manner, without a compiler overriding my design, is why I use some assembler.

  28. 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...

  29. 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.

  30. Re:Surprise? Why? by Tough+Love · · Score: 2

    There was a very good op-ed from the Usenet days which pointed out that an assembly programmer will always beat a high-level-language programmer on most performance metrics...

    Dozens of posts so far and all missing the central point: in terms of determining popularity, tiobe's methodology is junk. People search when they have questions. Sure, more people have questions if more people are using a given language, but this is trumped by obscurity and steep learning curve. Really, there is little in the technology world more obscure or harder to master than machine level coding. If a language is well structured then you just go straight to the web resources, the many excellent C++ sites for example. When nothing makes sense and you don't know where to start, you ask the search engine. Therefore poorly documented and really hard to use languages tend to look excessively "popular" to tiobe. Nonsense.

    Now, what really worries me... those people searching for answers about assembly language... they have no idea what they are in for, and what a hazard they are going to be if they actually try to apply the superficial level of knowledge you get from web answers to writing assembly level code of any complexity.

    --
    When all you have is a hammer, every problem starts to look like a thumb.
  31. Re:Surprise? Why? by UnknownSoldier · · Score: 2

    >> If you do not know assembly, you cannot be a really good coder
    > That is bollocks.

    Only shitty programmers are clueless about assembly, which in turn implies they lack an understanding of memory access patterns.

    Hint, try *reading*: Pitfalls of Object Oriented Programming

    Even Bjarne Stroustrup, the designer of C++, until 2012 was completely cluess _why_ doubly Linked Lists were so slow compared to Arrays

    HINT: Managing the L1 Cache usage is critical for performance sensitive code.

    Programmers concerned about speed use Data-Orientated Design. For details see CppCon 2014: Mike Acton "Data-Oriented Design and C++"

    Knowing when to use, and NOT to use OOP, makes a programmer better. Using design patterns without *thinking* shows others you don't understand programming.

    --
    Wanted: An Apple 2 Thunderclock Plus peripheral card.