Assessing The Energy Efficiency Of Programming Languages

Programming languages are generally defined as a more human-friendly way to program computers than using raw machine code. Within the realm of these languages there is a wide range of how close the programmer is allowed to get to the bare metal, which ultimately can affect the performance and efficiency of the application. One metric that has become more important over the years is that of energy efficiency, as datacenters keep growing along with their power demand. If picking one programming language over another saves even 1% of a datacenter’s electricity consumption, this could prove to be highly beneficial, assuming it weighs up against all other factors one would consider.

There have been some attempts over the years to put a number on the energy efficiency of specific programming languages, with a paper by Rui Pereira et al. from 2021 (preprint PDF) as published in Science of Computer Programming covering the running a couple of small benchmarks, measuring system power consumption and drawing conclusions based on this. When Hackaday covered the 2017 paper at the time, it was with the expected claim that C is the most efficient programming language, while of course scripting languages like JavaScript, Python and Lua trailed far behind.

With C being effectively high-level assembly code this is probably no surprise, but languages such as C++ and Ada should see no severe performance penalty over C due to their design, which is the part where this particular study begins to fall apart. So what is the truth and can we even capture ‘efficiency’ in a simple ranking?

Continue reading “Assessing The Energy Efficiency Of Programming Languages”

Supercon 2023: Ben Combee And The Hacker’s Guide To Audio/Video Formats

Media formats have come a long way since the early days of computing. Once upon a time, the very idea of even playing live audio was considered a lofty goal, with home computers instead making do with simple synthesizer chips instead. Eventually, though, real audio became possible, and in turn, video as well.

But what of the formats in which we store this media? Today, there are so many—from MP3s to MP4s, old-school AVIs to modern *.h264s. Senior software engineer Ben Combee came down to the 2023 Hackaday Supercon to give us all a run down of modern audio and video formats, and how they’re best employed these days.

Continue reading “Supercon 2023: Ben Combee And The Hacker’s Guide To Audio/Video Formats”

Hackaday Links Column Banner

Hackaday Links: September 8, 2024

OK, sit down, everyone — we don’t want you falling over and hurting yourself when you learn the news that actually yes, your phone has been listening to your conversations all along. Shocking, we know, but that certainly seems to be what an outfit called Cox Media Group (CMG) does with its “Active Listening” software, according to a leaked slide deck that was used to pitch potential investors. The gist is that the software uses a smartphone’s microphone to listen to conversations and pick out keywords that it feeds to its partners, namely Google, Facebook, and Amazon so that they can target you with directed advertisements. Ever have an IRL conversation about something totally random only to start seeing references to that subject pop up where they never did before? We sure have, and while “relationship mining” seemed like a more parsimonious explanation back in 2017, the state of tech makes eavesdropping far more plausible today. Then there’s the whole thing of basically being caught red-handed. The Big Three all huffed and puffed about how they were shocked, SHOCKED to learn that this was going on, with reactions ranging from outright denial of ever partnering with CMG to quietly severing their relationship with the company. So much for years of gaslighting on this.

Continue reading “Hackaday Links: September 8, 2024”

Fun And Failure

My sister is a beekeeper, or maybe a meta-beekeper. She ends up making more money by breeding and selling new queen bees to other beekeepers than she does by selling honey, but that doesn’t mean that she doesn’t also process the sweet stuff from time to time. She got a free steam-heated oscillating hot knife, used for cutting the waxy caps off of the tops of the cells before spinning the combs down to extract honey, and she thought it might be easier to use than her trusty hand-held electric hot knife.

The oscillating knife, which was built something like a century ago, hadn’t been used in decades. All of the grease had turned to glue, and the large v-belt wheel that made it go was hard to turn by hand, and the motor was missing anyway. So she gave it to my father and me as a project. How could we resist?

We found the original manual on the Internet, which said that it would run from any 1/2 hp motor, or could be optionally driven by a takeoff wheel from a tractor – unfortunately not an option in my sister’s honey house. But we did find a 3/4 hp bench grinder at Harbor Freight that conveniently fit inside the case, and bought the smallest v-belt pulley wheel that would fit the grinder’s arbor. We thought we were geniuses, but when we hooked it all up, it just stalled.

We spent more than a few hours taking the mechanism apart. It was basically an eccentric shaft with a bearing on the end, and the bearing ran back and forth in the groove of a sliding mechanism that the knife blade attached to. As mentioned above, everything was gunked, so we took it all apart. The bearing was seized, so we freed that up by getting the sand out of the balls. The bearing couldn’t move freely in the slide either, but we filed that down until it just moved freely without noticeable play. We added grease from this century, and reassembled it. It turned fine by hand.

But with the belt and motor attached, the mechanism still had just enough friction to stall out the motor. Of course we wrapped some rope around the shaft and pull-started it, and it made a hell of a racket, nearly vibrated itself off the table, and we could see that the marvelous zinc-coated frame that held it all together was racking under the tension. It would require a wholly new housing to be viable, and we hadn’t even figured out a source of steam to heat the knife.

In short, it was more trouble than it was worth. So we packed up the bench grinder in the original container, and returned it no-worse-for-wear to the Freight. But frankly, we had a fantastic time playing around with a noble machine from a long-gone past. We got it “working” even if that state was unworkable, and we were only out the cost of the small v-belt pulley. Who says all of your projects have to be a success to be fun?

Hackaday Podcast Episode 287: Raspberry Pi Woes, Blacker Than Black, And Printing With Klipper

Elliot Williams is back from vacation, and he and Al Williams got together to talk about the best Hackaday posts from the last week. Of course, the Raspberry Pi RP2350 problem generated a bit of discussion.

On a lighter note, they saw laser lawn care, rooting WiFi devices, and some very black material made from wood. Need more current-sinking capability from a 555? They talked about that, too, along with a keyboard you use with your feet.

The guys had a lot to say about Klipper, why you might want to move your 3D printer to it, and the FCC’s stance on ham radio antennas in restricted neighborhoods. Oh, and don’t forget to play “What’s that Sound?”

DRM? Who’s got time for that? Download our legally unencumbered MP3.

Continue reading “Hackaday Podcast Episode 287: Raspberry Pi Woes, Blacker Than Black, And Printing With Klipper”

This Week In Security: EUCLEAK, Revival Hijack, And More

[Thomas Roche] of NinjaLab is out with EUCLEAK, (pdf) a physical attack against Infineon security microcontrollers, and the security tokens that contain them. The name is a portmanteau of Euclidean and leak. And no surprise, it’s a data leak in some implementations of the Extended Euclidean Algorithm (EEA), a component of an Elliptical Curve Digital Signature Algorithm (ECDSA).

OK, time to step back. Infineon microcontrollers are the digital smart parts inside popular security tokens like the Yubikey 5, some Java smart cards, and even the Infineon TPMs. These devices all serve a similar purpose. They store one or more secret keys, and are guaranteed to never disclose those keys. Instead, they use their secret keys to do cryptographic functions, like ECDSA signatures, and output the result. There’s even a special set of tests, the Common Criteria, that are intended to backstop these guarantees. What’s interesting is that an otherwise excellent product like the Yubikey 5, that passes all these auditing and certification processes, is still vulnerable.

The actual attack is to perform ECDSA signatures while monitoring the physical chip with an electromagnetic probe. This tiny directional antenna can pick up on EM noise generated by the microprocessor. That EM noise leaks timing information about the internal state of the cryptography, and the secret key can be derived as a result.

This process does require physical access to the token for several minutes. To get useful readings, the plastic case around the security token does need to be disassembled to get the probe close enough to pick up signals. From there it’s at least an hour of post-processing to actually get the key. And most of these security tokens intentionally make the disassembly process rather difficult. The point isn’t that it’s impossible to open up, but that it’s impossible not to notice that your token has been tampered with. Continue reading “This Week In Security: EUCLEAK, Revival Hijack, And More”

I2C For Hackers: Digging Deeper

Last time, I gave you an overview of what you get from I2C, basics like addressing, interface speeds, and a breakdown of pullups. Today, let’s continue looking into I2C capabilities and requirements – level shifting, transfer types, and quirks like combined transfers or clock stretching.

Level Shifting

Continue reading “I2C For Hackers: Digging Deeper”