
If you missed our first conversation with Larry Bank – open-source developer experienced in code optimization and a contributor to the Arduino library ecosystem – start there. It covers his origins as a performance engineer, his philosophy on what efficient code means for embedded systems, and why squeezing the maximum out of modest hardware is as relevant today as it was in the early days of computing.
We recently caught up with Bank again to go further. On the question of hardware vs. software bottlenecks his position remains consistent: “while there are obvious hardware red flags – like attempting heavy double-precision floating-point math on an 8-bit AVR microcontroller – makers should always assume there’s a more efficient way to structure their software.” Feel stuck? His advice is to first look at what others have already accomplished on the same chip, and to reach for profiling tools early. He’s also written about this directly in his blog, where he shares additional perspectives on optimization techniques.
Read on for what’s new: the mechanics of cross-platform library design, the realities of sustaining open-source software (FOSS), and his latest projects aimed at reducing developer frustration.
On balancing performance, portability, and simplicity
Thinking about your activity on code libraries, how do you balance performance, portability, and simplicity when your code needs to work across many different Arduino® boards and architectures?
LB: I really like the Arduino C++ API and class structure of the standard libraries; I use this design paradigm as a guide to keep the code as simple as possible. Often, I’ll start with C “worker” functions, then design a C++ class to wrap the C functions with a high-level, easy-to-use API. For simple libraries, I can write it all in C++ from the start.
C and C++ are still the main path to portability. Through the last 40 years, they have remained widely supported options for running code across many CPUs and operating environments. I use Arduino’s API as a portability tool too. This allows me to extend my libraries to work on Linux and non-Arduino targets by creating wrapper functions which mimic the Arduino functions. For example, to control GPIO ports on Linux, I wrote pinMode, digitalWrite, and digitalRead functions which wrap the Linux gpiod functions. These I/O wrapper functions are placed in a separate source file, so that the main library source code is identical for Arduino, Linux, and other targets.
As far as performance, I always write my code with efficiency in mind from the beginning. I think that old adage about premature optimization is taken out of context. For my imaging and video codecs, I was only able to optimize them as well as I have by running them in Apple’s Xcode profiling tool. Since my library code is portable, using my Arduino libraries inside a macOS or iOS project doesn’t require any extra effort. On the super-fast processor of my MacBook, I can run thousands of iterations of every function to pinpoint the performance bottlenecks. The Xcode profiler can provide line-level timing information in addition to function-level information.
The realities of sustaining open-source software
Open-source software is free to use, but creating and maintaining it requires considerable time and expertise. What could individuals and companies do to support contributors more effectively?
LB: The first step is probably awareness – letting the public know that most open-source software is not compensated and done for various personal motives. It doesn’t help that the last 20 years of ad-supported software has trained people to think that mobile and web software is free. While there isn’t a standard way to give financial support to open-source projects, common avenues are through Ko-Fi, Github sponsors and direct payments like PayPal. A few kind people have been supporting my work with monthly donations on Github, while others have done random donations after I helped them with their projects. I’ve also been awarded a few grants from the Nlnet Foundation, an EU organization supporting FOSS for many years. On a few occasions I’ve done some more creative financing of a project by licensing it with a limited exclusivity period to companies that wanted a head start in the market before being released as open source. Each of these ways helps, but it’s not enough. Ultimately, I think governments (the ones that work for the benefit of their people) need to connect the dots and see the value in supporting FOSS as a public good.
I’m going to try a new idea in the near future where I offer customized support on Github for different levels of monthly donations. For example, priority issue resolution or even tutoring/consulting time. Ideally, I think it’s high time to get serious about a system of micropayments where people can contribute a tiny amount for their use of open-source projects and in aggregate it will help the maintainers.
What would you like Arduino community members to understand about the people who build and maintain the libraries they use every day?
LB: I can’t speak for others, but for me, I have a lot of gratitude for the open-source community and all of the work which powers so much of our digital lives. I want to use my experience to give back in some unique way. My libraries are my way of sharing my accumulated knowledge in a way that I hope can benefit the world. Unlike private company software which typically has a very short shelf life, open-source code can exist and improve for many years. This longevity is a good motivation compared to the throw-away code I’ve written for the big tech companies in the past.
Reducing frustration in embedded development
What is your top reason for contributing specifically to the Arduino ecosystem?
LB: For me, Arduino has always been about connecting hardware to software. My first impression of the Arduino® UNO
board was that it was limited to things like monitoring pushbuttons, blinking LEDs, and maybe activating relays. Once I saw that I could use it for projects with sensors, displays, images, and more complex tasks, I was hooked.
Beyond pushing the boundaries and showing what’s possible on humble hardware, my main motivation for the past few years has been to reduce the frustration level of working in this field. Software development is frustrating, and embedded development is an order of magnitude more frustrating than that. Most of my libraries and their APIs are designed to help simplify a complex topic while still allowing expert users to dig into the fine details. A good example is my AnimatedGIF library – I recently added an optional Player class which simplifies playing GIF animations even further, for those who just want a single line of code to do the whole job.
“Smart” libraries: auto-detecting sensors
Besides imaging libraries which are optimized for performance, is there any other aspect of your open-source work that you would like to highlight?
LB: Towards the goal of reducing developer frustration, I released several sensor libraries which work with a whole class of different sensors instead of just a single one. For example, if you want to use a temperature and humidity sensor, instead of searching for a library for your specific sensor, my library already includes support for it and can auto-detect not only the type, but its I2C address.
The idea came from an experience working with a colleague. We were both setting up Linux boards with Bosch BME280 sensors purchased from different vendors, and his sensor used a different I2C address than mine. When he ran the software which worked fine on my setup, it failed to work on his. My first solution was to have the code probe all possible addresses of that specific sensor. Realizing I could uniquely detect many different I2C sensors without user intervention, I created libraries for whole sensor classes (capacitive touch, temperature/humidity, proximity/light, IMUs, etc.). Each library auto-detects popular sensors and can work with supported sensors without manual selection, designed to reduce a pain point discussed in support forums.
What’s next: H.263 video and IDE discoverability
What kind of project would you love to see the Arduino community build using one of your libraries?
LB: I just released a new library for playing H.263 videos. It’s an obsolete video codec from many years ago, but it solves a specific problem for embedded devices: it can offer advantages over Motion-JPEG and GIF for certain animated-content use cases. Since it’s a true video codec with inter-frame compression, the video file size can be smaller, depending on the content and encoding settings. Hopefully people can put it to good use!
What changes would you like to see for the Arduino ecosystem or tools?
LB: I would like to see more effort towards discoverability. I often see people struggling with issues that I’ve already solved in my libraries and blog posts. A new feature for the Arduino IDE that could help would be a popup window to highlight a specific library each day – e.g., “Did you know that the X library supports Y?” – with an option to opt out.
True to open-source!
Any final thoughts?
LB: Thank you for the opportunity to talk about Arduino, embedded software and my FOSS efforts. I really appreciate Arduino’s support of open hardware and software. Looking towards the future of this field, I would like to see a bit more disclosure on the sales side of embedded/IoT devices. If someone buys a device with preloaded firmware and is happy to never change it and doesn’t care to learn the details, there’s nothing wrong with that. However, if someone buys a device with the expectation that programming their custom project will be relatively easy, then they should have an honest understanding that learning how to write software takes time and effort, but can be very rewarding. It’s clear that many devices end up collecting dust in a box in your garage because on the path to realizing your idea, the frustration level was too high. I will continue to work towards reducing that frustration through my software and blog articles while simultaneously advocating for educating the public on the level of effort and commitment needed to realistically see their projects through to completion.
Bank’s commitment to reducing frustration and sharing knowledge freely is consistent with values commonly associated with open-source communities. If you want to follow along as he continues building, optimizing, and releasing new libraries, his GitHub profile and blog are the places to be!
Arduino, UNO, and the Arduino logo are trademarks or registered trademarks of Arduino S.r.l.
The post Code optimization, FOSS sustainability, and library design: our conversation with Larry Bank appeared first on Arduino Blog.
Read more here: https://blog.arduino.cc/2026/12/04/code-optimization-foss-sustainability-and-library-design-our-conversation-with-larry-bank/


