# The Second-Fastest Kind of Code

- Speaker: [Tal Tiano Einat](/wiki/speakers/tal-tiano-einat.md)
- Event: [Reversim Summit 2024](/wiki/years/2024.md)
- Video: https://www.youtube.com/watch?v=PmyBgLckW8A
- Transcript: [/transcripts/2024/39-PmyBgLckW8A.md](/transcripts/2024/39-PmyBgLckW8A.md)
- Language: Hebrew · Type: talk · Level: intermediate
- Topics: [Scalability](/wiki/topics/scalability.md), [Productivity](/wiki/topics/productivity.md), [Developer Experience](/wiki/topics/developer-experience.md), [Architecture](/wiki/topics/architecture.md)

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

## Summary

This talk explores the concept of early computation as a powerful technique to optimize slow code by performing heavy initialization or data loading ahead of time. The speaker shares personal experiences ranging from caching matrix multiplications to building a generic daemon wrapper that speeds up slow CLI tools and git hooks. The audience learns how shifting initialization tasks to a persistent background process or pre-loading state can drastically improve software performance and developer workflow.

## Key points

- [0:00](https://www.youtube.com/watch?v=PmyBgLckW8A) The speaker introduces the core philosophy that the fastest code is the code that does not run at all through pre-computed results.
- [1:02](https://www.youtube.com/watch?v=PmyBgLckW8A&t=62s) While working with an open-source license detection CLI tool, the speaker noticed it was slow because it loaded static license data on every startup.
- [2:02](https://www.youtube.com/watch?v=PmyBgLckW8A&t=122s) By wrapping the CLI tool in an HTTP server to keep the data loaded in memory, the performance bottleneck was easily eliminated.
- [3:02](https://www.youtube.com/watch?v=PmyBgLckW8A&t=182s) To solve slow python-based pre-commit hooks caused by repeated interpreter startup and imports, the speaker built a generic daemon written in Bash and local sockets.
- [4:02](https://www.youtube.com/watch?v=PmyBgLckW8A&t=242s) The speaker introduces a custom tool named Jump The Gun which applies this daemon architecture to keep tools ready and eliminate overhead.
- [5:06](https://www.youtube.com/watch?v=PmyBgLckW8A&t=306s) The overarching principle of early computation encompasses patterns like cache warming and over-provisioning servers to achieve maximum performance.

## Takeaways

- Identify initialization bottlenecks such as heavy startup scripts or static data loading that occur on every run.
- Use background daemons or long-running HTTP wrappers to keep expensive application state loaded in memory between requests.
- Apply early computation principles like cache warming or pre-provisioning to improve both runtime speed and developer experience.

## Questions this talk answers

- How can I eliminate startup overhead and slow load times in CLI tools or scripts?
- When should I use a long-running daemon process versus traditional caching mechanisms?
- How does pre-loading application state or dependencies improve developer workflows like git hooks?

## Technologies

Go, Python, Rust, Bash

## Tags

architecture, caching, cli, developer tools, performance optimization
