preciz
I like to find performance optimizations and hidden bugs in Elixir codebases with coding agents.
If I just ask them directly to find those, they are not that successful, but recently I found two ways that are more fruitful.
Core Erlang and BEAM bytecode inspection:
If I ask my agent to inspect the Core Erlang and BEAM bytecode of a module, it finds much more insightful details and higher quality performance patches.
One of my prompts looks like this:
Further refactor ModuleName.function towards the Pareto frontier of performance, simplicity, elegance.
First, always check the Core Erlang & BEAM bytecode. Then do the refactor, then check Core Erlang & BEAM bytecode again so you continuously gain performance insights from them.
If there are low hanging performance improvement opportunities, the above prompt can find those usually.
Lean 4 formalization:
I would do something like this:
/goal Fully formalize module N of this Elixir codebase in a new formalization/ dir with the Lean 4 theorem prover.
Then it goes to work for a long time (it probably never finishes), but while the main thread is running, I’m using the /btw command to ask questions about the code based on the formalization. This can find very interesting things about the code and it seems like the optimizations/bugs/security issues it can find this way are numerous.
My Conclusion:
Maybe these are just different ways to force an agent to do work and to look at code from different perspectives, but I found that these work well enough to find surprisingly good issues in established codebases.
Trending in AI / LLMs
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
mudasobwa
The examples of both in the shape “Code: …, AI Finding: …, Fix: …” would have drastically improved the quality of this observation.
preciz
For me the real insight here is to force the agent to use Core Erlang, BEAM bytecode, Lean 4. Not in what form it reports the issues if you mean that.
mudasobwa
I mean without an example this is not an insight. I was advocating for using static analysis with AI for more than a year already, but I am also an author of a bunch of static tools, way more powerful than just looking into bytecode, and I am an author of Cure language, making Lean4 just a redundant link in this chain.
preciz
That’s great, cause one of my goals were to learn more about this space. I’m now looking into Cure then.