# Less is more: how we cut off 30% of our code that did nothing without trying to

- Speaker: [Gilad Ben Yossef](/wiki/speakers/gilad-ben-yossef.md)
- Event: [Reversim Summit 2018](/wiki/years/2018.md)
- Video: https://www.youtube.com/watch?v=Tolv2Za-MyY
- Transcript: [/transcripts/2018/59-Tolv2Za-MyY.md](/transcripts/2018/59-Tolv2Za-MyY.md)
- Language: Hebrew · Type: talk · Level: intermediate
- Topics: [Technical Debt](/wiki/topics/technical-debt.md), [Software Engineering](/wiki/topics/software-engineering.md), [IoT](/wiki/topics/iot.md), [Infrastructure](/wiki/topics/infrastructure.md)

> Written by an LLM from machine transcripts. It can contain errors. Check the transcript before you quote it.

## Summary

The speaker shares an accidental discovery made by the team while upstreaming a device driver into the Linux kernel, where they managed to cut thirty percent of the codebase. By examining the bloated code, the team identified common anti-patterns such as reinventing the wheel, dealing with backwards compatibility, and maintaining dead code. The talk highlights how going through community code review processes helps uncover and eliminate redundant logic. Ultimately, the audience learns practical strategies for reducing technical debt and writing leaner, more maintainable software.

## Key points

- [0:12](https://www.youtube.com/watch?v=Tolv2Za-MyY&t=12s) The speaker and the team accidentally cut thirty percent of their codebase because it did not do anything useful.
- [8:18](https://www.youtube.com/watch?v=Tolv2Za-MyY&t=498s) The project involved taking an out-of-tree hardware security driver and upstreaming it into the official Linux kernel.
- [8:18](https://www.youtube.com/watch?v=Tolv2Za-MyY&t=498s) The first anti-pattern found was reinventing the wheel by writing custom functions that already existed in the kernel infrastructure.
- [16:15](https://www.youtube.com/watch?v=Tolv2Za-MyY&t=975s) Backwards compatibility code often creates massive bloat with complex conditional checks instead of fixing the underlying framework.
- [19:20](https://www.youtube.com/watch?v=Tolv2Za-MyY&t=1160s) Excessive macro gymnastics and hardware abstraction layers often add unnecessary complexity when targeting a specific operating system.
- [21:52](https://www.youtube.com/watch?v=Tolv2Za-MyY&t=1312s) Unused dead code can accumulate over time in large projects, increasing maintenance overhead and security risks.
- [23:06](https://www.youtube.com/watch?v=Tolv2Za-MyY&t=1386s) Code duplication happens naturally over time, but strict reviews help consolidate duplicate logic into common functions.
- [25:34](https://www.youtube.com/watch?v=Tolv2Za-MyY&t=1534s) Upstreaming the driver and engaging with the open-source community exposed the code to expert reviews that significantly improved its quality.

## Takeaways

- Check existing framework and kernel infrastructure before writing custom solutions to avoid reinventing the wheel.
- Fix upstream or framework issues directly instead of bloating your own driver with complex compatibility workarounds.
- Treat the code review process as an opportunity to clean up dead code and reduce technical debt.

## Questions this talk answers

- How can developers identify redundant code before writing it?
- What are the best strategies for handling backwards compatibility without bloating the codebase?
- How does the open-source upstreaming process help improve code maintainability?

## Technologies

Linux, Android, Python

## Tags

code quality, device drivers, linux kernel, open source, refactoring, technical debt
