The Performance Impact Of C++’s `final` Keyword For Optimization

In the world of software development the term ‘optimization’ is generally reason for experienced developers to start feeling decidedly nervous, especially when a feature is marked as an ‘easy and free optimization’. The final keyword introduced in C++11 is one of such features. It promises a way to speed up object-oriented code by omitting the vtable call indirection by marking a class or member function as – unsurprisingly – final, meaning that it cannot be inherited from or overridden. Inspired by this promise, [Benjamin Summerton] figured that he’d run a range of benchmarks to see what performance uplift he’d get on his ray tracing project.

To be as thorough as possible, the tests were run on three different systems, including 64-bit Intel and AMD systems, as well as on Apple Silicon (M1). For the compilers various versions of GCC (12.x, 13.x), as well as Clang  (15, 17) and MSVC (17) were employed, with rather interesting results for final versus no final tests. Clang was probably the biggest surprise, as with the keyword added, performance with Clang-generated code absolutely tanked. MSVC was a mixed bag, as were the GCC versions other than GCC 13.2 on AMD Ryzen, which saw a bump of a few percent faster.

Ultimately, it seems that there’s no free lunch as usual, and adding final to your code falls distinctly under ‘only use it if you know what you’re doing’. As things stand, the resulting behavior seems wildly inconsistent.

Downloading Satellite Imagery With A Wi-Fi Antenna

Over the past century or so we’ve come up with some clever ways of manipulating photons to do all kinds of interesting things. From lighting to televisions and computer screens to communication, including radio and fiber-optics, there’s a lot that can be done with these wave-particles and a lot of overlap in their uses as well. That’s why you can take something like a fairly standard Wi-Fi antenna meant for fairly short-range communication and use it for some other interesting tasks like downloading satellite data.

Weather satellites specifically use about the same frequency range as Wi-Fi, but need a bit of help to span the enormous distance. Normally Wi-Fi only has a range in the tens of meters, but attaching a parabolic dish to an antenna can increase the range by several orders of magnitude. The dish [dereksgc] found is meant for long-range Wi-Fi networking but got these parabolic reflectors specifically to track satellites and download the information they send back to earth. Weather satellites are generally the target here, and although the photons here are slightly less energy at 1.7 GHz, this is close enough to the 2.4 GHz antenna design for Wi-Fi to be perfectly workable and presumably will work even better in the S-band at around 2.2 GHz.

For this to work, [dereksgc] isn’t even using a dedicated tracking system to aim the dish at the satellites automatically; just holding it by hand is enough to get a readable signal from the satellite, especially if the satellite is in a geostationary orbit. You’ll likely have better results with something a little more precise and automated, but for a quick and easy solution a surprisingly small amount of gear is actually needed for satellite communication.
Continue reading “Downloading Satellite Imagery With A Wi-Fi Antenna”

More Mirrors (and A Little Audio) Mean More Laser Power

Lasers are pretty much magic — it’s all done with mirrors. Not every laser, of course, but in the 1980s, the most common lasers in commercial applications were probably the helium-neon laser, which used a couple of mirrors on the end of a chamber filled with gas and a high-voltage discharge to produce a wonderful red-orange beam.

The trouble is, most of the optical power gets left in the tube, with only about 1% breaking free. Luckily, there are ways around this, as [Les Wright] demonstrates with this external passive cavity laser. The guts of the demo below come from [Les]’ earlier teardown of an 80s-era laser particle counter, a well-made instrument powered by a He-Ne laser that was still in fine fettle if a bit anemic in terms of optical power.

[Les] dives into the physics of the problem as well as the original patents from the particle counter manufacturer, which describe a “stabilized external passive cavity.” That’s a pretty fancy name for something remarkably simple: a third mirror mounted to a loudspeaker and placed in the output path of the He-Ne laser. When the speaker is driven by an audio frequency signal, the mirror moves in and out along the axis of the beam, creating a Doppler shift in the beam reflected back into the He-Ne laser and preventing it from interfering with the lasing in the active cavity. This forms a passive cavity that greatly increases the energy density of the beam compared to the bare He-Ne’s output.

The effect of the passive cavity is plain to see in the video. With the oscillator on, the beam in the passive cavity visibly brightens, and can be easily undone with just the slightest change to the optical path. We’d never have guessed something so simple could make such a difference, but there it is.

Continue reading “More Mirrors (and A Little Audio) Mean More Laser Power”

DIY DNA Lamp

DIY Electronics Plus Woodworking Equal Custom Lamp

There is something about wooden crafts that when combined with electronics, have a mesmerizing effect on the visual senses. The Gesture Controlled DNA Wooden Desk Lamp by [Timber Rough] is a bit of both with a nice desk piece that’s well documented for anyone who wants to build their own.

Construction starts with a laser cutter being employed to add kerfs, such that the final strips can be bent along a frame tube to form the outer backbone of the DNA helix structure. Add to the mix some tung oil, carnauba wax, and some glue — along with skill and patience — and you get the distinct shape of sugar-phosphate backbone.

The electronics include an ESP8266 with the PAJ7620 gesture sensor that controls two WS2812B RGB LED Strips. The sensor in question is very capable, and comes with the ability to recognize nine human hand gestures along with proximity which makes it apt for this application. The sensor is mounted atop the structure with the LEDs twisting down the frame to the base where the ESP8266 is tucked away. Tiny glass bottles are painted with acrylic spray varnish and then glued to the LEDs to form the base pairs of the double helix. We thought that the varnish spray was a clever idea to make light diffusers that are quick and cheap for most DIYers.

We previously covered how this particular gesture sensor can be used to control much more than a lamp if you seek more ideas in that realm.

Continue reading “DIY Electronics Plus Woodworking Equal Custom Lamp”

Supercon 2023: Alex Lynd Explores MCUs In Infosec

The average Hackaday reader hardly needs to be reminded of the incredible potential of the modern microcontroller. While the Arduino was certainly transformative when it hit the scene, those early 8-bit MCUs were nothing compared to what’s on the market now. Multiple cores with clock speeds measured in the hundreds of megahertz, several MB of flash storage, and of course integrated WiFi capability mean today’s chips are much closer to being fully-fledged computers than their predecessors.

It’s not hard to see the impact this has had on the electronics hobby. In the early 2000s, getting your hardware project connected to the Internet was a major accomplishment that probably involved bringing some hacked home router along for the ride. But today, most would consider something like an Internet-connected remote environmental monitor to be a good starter project. Just plug in a couple I2C sensors, write a few lines of Python, and you’ve got live data pouring into a web interface that you can view on your mobile device — all for just a few bucks worth of hardware.

But just because we’re keenly aware of the benefits and capabilities of microcontrollers like the ESP32 or the Pi Pico, doesn’t mean they’ve made the same impact in other tech circles. In his talk Wireless Hacking on a $5 Budget, Alex Lynd goes over some examples of how he’s personally put these devices to work as part of his information security (infosec) research.

Continue reading “Supercon 2023: Alex Lynd Explores MCUs In Infosec”

The First European Pocket Calculator Came From Yugoslavia

At the start of the 1970s the pocket calculator was the last word in personal electronics, and consumers in Europe looked eagerly towards Japan or the USA for a glimpse of new products. Meanwhile the European manufacturers, perhaps Philips in the Netherlands, or Olivetti in Italy, would no doubt have been putting their best engineers on to the task of delivering the first domestic European models.

So who was first with a European-made calculator? Not the Dutch, the Italians, the Germans, or even the Brits, instead that honour went to the Yugoslavians. Digitron is a company located in Buje, in modern-day Croatia, and they pipped everyone else in Europe to the post back in 1971 with their DB800 model.

We read about the achievement through the above-linked exhibition, but perhaps the greatest surprise comes in finding relatively little technical information online about these machines. Other early calculators have been subjected to extensive teardowns, so we can see all manner of interesting period tech. This one however, other than references to using Japanese parts, has very little. Whose chip did it use, and were there any quirky design choices made? We hope that someone out there has one and is prepared to give the world a peek.

Meanwhile, we’ve looked at a few older calculators ourselves.

Mining And Refining: Uranium And Plutonium

When I was a kid we used to go to a place we just called “The Book Barn.” It was pretty descriptive, as it was just a barn filled with old books. It smelled pretty much like you’d expect a barn filled with old books to smell, and it was a fantastic place to browse — all of the charm of an old library with none of the organization. On one visit I found a stack of old magazines, including a couple of Popular Mechanics from the late 1940s. The cover art always looked like pulp science fiction, with a pipe-smoking father coming home from work to his suburban home in a flying car.

But the issue that caught my eye had a cover showing a couple of rugged men in a Jeep, bouncing around the desert with a Geiger counter. “Build your own uranium detector,” the caption implored, suggesting that the next gold rush was underway and that anyone could get in on the action. The world was a much more optimistic place back then, looking forward as it was to a nuclear-powered future with electricity “too cheap to meter.” The fact that sudden death in an expanding ball of radioactive plasma was potentially the other side of that coin never seemed to matter that much; one tends to abstract away realities that are too big to comprehend.

Things are more complicated now, but uranium remains important. Not only is it needed to build new nuclear weapons and maintain the existing stockpile, it’s also an important part of the mix of non-fossil-fuel electricity options we’re going to need going forward. And getting it out of the ground and turned into useful materials, including its radioactive offspring plutonium, is anything but easy.

Continue reading “Mining And Refining: Uranium And Plutonium”