What does Oaklean do?
Oaklean helps developers write more energy-efficient code. It measures how much energy individual functions, components, and libraries consume when executed – right within the Node.js environment.
Imagine being able to see which parts of your code consume the most energy – much like an electricity meter (or energy consumption meter) in your home. That’s exactly what Oaklean does: It shows you which functions in your project are the biggest “energy consumers” and where targeted optimizations can reduce your application’s carbon footprint.
JSX, TSX, and WebAssembly? No problem anymore!
Applications built with React and TSX files are now fully supported. This means developers no longer have to sacrifice specific features in order to analyze energy consumption. WebAssembly is also now supported. Since this code is difficult to trace directly, Oaklean treats it as a self-contained unit – ensuring consistent measurement.
Better detection – even with “invisible” code
A common scenario: functions that are executed automatically or without a clear caller – this often occurred due to dynamic imports at runtime. These “invisible” functions were previously lost in the analysis – now they are captured and accounted for separately.
Greater accuracy in assigning measured values
In earlier versions, usage data was occasionally assigned to the wrong library in rare cases – for example, when a library code called a function from your own project. The new version detects such cases and ensures that the usage is assigned to the correct location.
Tracking Despite Code Changes
Even when you revise or refactor your code, Oaklean stays on top of things. It identifies functions not only by their names, but also by their context and structure. This ensures that the measurement results remain reliably traceable even after refactoring.
Improved handling of bundled code (bundles)
Many applications today are bundled using tools like Webpack, which makes code analysis significantly more difficult. In earlier versions of Oaklean, it was difficult to correctly trace the origin of individual functions in such bundle files – especially when third-party libraries and custom functions were intermixed. The new version now accurately identifies which part of a bundle belongs to your own code and which part belongs to an external library. This ensures that energy consumption is reliably attributed to the correct source – a significant improvement in terms of accuracy.
Why all this?
Because every line of code counts. Software consumes power – and energy consumption really adds up, especially with large, long-running applications. By keeping an eye on this, you can not only help the environment but also save costs and improve your software’s performance.
Conclusion
Oaklean demonstrates that sustainability and software development don’t have to be at odds with one another. With these new features, it’s easier than ever for developers to identify energy-intensive sections of code and make targeted improvements.
Kay Makowsky’s presentation made it clear how important it is to take our responsibility as developers seriously – and that tools like Oaklean can help us design code that is not only functional but also future-proof.
Oaklean is open source – and thrives on the community. Learn more