Posted on 07/17/2025 11:00:22 AM PDT by ShadowAce
The developers behind the FFmpeg project are again claiming major performance uplifts delivered by wielding the art of handwritten assembly code. With the latest patch applied, users should see a “100x speedup” in the cross-platform open-source media transcoding application. However, the developers were soon to clarify that the 100x claim applies to just a single function, “not the whole of FFmpeg.”
BREAKING: FFmpeg 100x speedup from handwritten assembly13:55:30 <•haasn> rangedetect8_avx512: 121.2 (100.18x) that may be the biggest speedup I've seen so farJuly 16, 2025
“The biggest speedup I've seen so far”
Last November, we reported on an FFmpeg performance boost that could speed certain operations by up to 94x. The latest handwritten assembly patch boosts the app’s ‘rangedetect8_avx512’ performance by 100.73%. If your modern processor doesn’t support AVX512, you should still see a 65.63% uplift with the rangedetect8_avx2 code path.
Where will you feel these speed increases? In some follow-up tweets, the FFmpeg developers admit that “It's a single function that's now 100x faster, not the whole of FFmpeg.” They would later go on to elaborate that the functionality, which might enjoy a 100% speed boost, depending upon your system, was “an obscure filter.”
The obscurity of the function means it hadn’t been prioritized by the devs until now. But we also gather that the filter code was recoded using the SIMD (Single Instruction, Multiple Data) processing concept for vastly improved parallel processing on today’s powerful chips.
Evidently, compilers – programs that take higher-level language code and spit out assembly (machine) code – are still not competitive with handwritten assembly. Or you could say, “register allocator sucks on compilers,” as FFmpeg tweeted today.
Assembly language evangelicals
Harking back to the golden age of home computing in the 1980s and 1990s, where fixed-spec systems had lifecycles measured in half-decades - and strictly limited processing resources - handwritten assembly code optimizations played a larger part in the business of speeding up computers, games, and other software.
FFmpeg is perhaps one of the few ‘assembly evangelists’ remaining. The dev team even runs a ‘school.’
FFmpeg tools and libraries run across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, systems, and more. One of the most popular video player software utilities, VLC, uses the libavcodec and libavformat libraries from the FFmpeg project.
When I went to school for computer programming, we had three languages. First was COBOL, second was RPGII, and third was Basic Assembler. Interestingly, I got my best grades in Basic Assembler and I’m not sure why. A lot of people questioned my sanity when they heard that... ha ha ha.
I haven’t used any of those three languages in my work career which will most likely be ending in 2 years.
COBOL and Assembler.......I learned IBM 360 versions of both in college in the ‘70’s,
______________________________________________________
I decided to go back to school in the 70’s back when Z-80’s were popular. The z-80 was a pain to program because there were no registers larger than 8 bit, yeah there were a couple methods to fake a 16 bit register. You could get some real performance from the Z-80. Hand programming was the only way to get speed. I remember when Microsoft had the Microsoft Basic Assembler. It was very cool, it worked but when I saw the Z-Basic assembler run circles around MBASM I was converted. Assembler on a 360/370 was amazing, there were true 32 bit registers. You could do true multiply commands. Those were pretty interesting days.
The thing I hated about those days was that everything was done on a deck of cards. Get one card out of sequence and your compile would fail and the error report was sometimes meaningless.
“ I’ve been saying for years that the reason software eats up so much hardware (and its advances) is the compiler.”
Also the software/hardware interface. That’s what IBM’s AS/400 fixed.
I learned assembler code in 1978 in the basement of the empire state building. Retired after 42 years in IT and loving it;-)
Wrote a ton of assembler and hand assembled machine code for 8086 and similar microcontroller processors back in the day. Always enjoyed it. Optimizing inner loops and memory was great geeky fun. Squeezing a table of trig function values by a factor of 8 is still a fond memory.
You know you are old when you read through this article and understand it.
The reason they let me rewrite it is because of what happened regarding the reason I was hired as contractor in the first place. They were adding area codes to the Seattle area and they hired a bunch of contractors to modify hard code and programs to add the new area codes and of course, the logic that each of these new area codes required.
Because all the area codes were hard coated in the logic are instructions were to, every time it was asking what area code it was for to know what to do, we were to add the new area codes, as well as the data points to apply to that particular call. Tax rates and things like that.
I was assigned 12 programs and each one had three to five places in the program where they asked the question and did something according to the area code. So what did I do? And all of them I created a table a area codes, and for each table entry where all of the data points that would be modified at various points in the program based on the table entry for the call the program is currently working on.
My contract lasted 2 years and a year after it ended the project manager for the next area code project literally called me at home and thanked me profusely. He said that the 12 programs I had modified only needed to have a new table row included for each of the new area codes. That was probably one of the most exciting parts of my career frankly.
Going to be clear, I made the tables large enough to be able to handle new area codes because, naturally, I figured they would be creating new area codes.
Disclaimer: Opinions posted on Free Republic are those of the individual posters and do not necessarily represent the opinion of Free Republic or its management. All materials posted herein are protected by copyright law and the exemption for fair use of copyrighted works.