Sheety 1.1.0: This time it's personal
This is the second release of Sheety my tool to compile spreadsheets to native code.
Yes, that means that you can take a spreadsheet and turn it into a binary, which runs, where all your formulas are compiled to native code. This is a very weird project, but it's also lots of fun.
What is new in this release?
Bugs Fixed
- Cells with names like A100 were not being recognized as valid cell names. Now they are.
- The cache was not being invalidated when the sheety binary changed. Now it is.
- Updated for more modern crystal versions.
Performance
This was the fun part.
Extract similar formulas to a function
If you had two formulas like:
=IF(A1>0, A1*2, A1/2)
=IF(A2>0, A2*2, A2/2)
Version 1.0 would generate two separate functions for each of those formulas, which is wasteful. Now it generates a single function, and calls it with the cell as an argument. This makes the generated code MUCH smaller.
Don't generate code for each cell's task
Previously, each cell would generate code to create a separate Croupier::Task, and now
we have a table that is looped, and we only have one instantiation. Again, makes the code
simpler.
Split the generated code into multiple files
This was a bit surprising. I have an example that has 9900 cells with chained formulas. Version 1.0 generated a single file with 9900 functions, and the compiler would crash because it ran out of memory.
Splitting it in multiple files and not enabling optimizations makes the compiler happy and stay below a couple of GB or so. This is an issue with the crystal compiler itself, and this workaround makes that large file actually work.
Conclusion
As usual: this is useless for 99.99% of people, but it's a fun codebase, and I am confident it would make for a nice workshop or talk. If you want to try it, just check https://sheety.ralsina.me and download the binary for your platform. It works on Linux.
You can probably build it from source on Windows and Mac, but I haven't tried it. If you do, please let me know how it goes.