4 ms·
Something I've mused about is whether it would be possible to reason about performance characteristics at a types level, to statically identify things like quad
by brundolf 6y ago
Something I've mused about is whether it would be possible to reason about performance characteristics at a types level, to statically identify things like quadratic behavior. No idea what this would look like; I just see this gap where type systems have gotten quite good at ensuring against incorrectness (not C's, of course, but that's another discussion), but there's almost no equivalent story for catastrophic performance regressions, which in some cases can be just as serious as a program-crashing bug.
Basically when it comes to performance we're still in the place that we used to be with correctness: "either read the entire stack of source code to understand everything that's happening, or try and remember to read the docs which may or may not be correct and exhaustive and just hope for the best".
The performance characteristics of a piece of code are part of its contract with the outside world, but that contract is in no way formalized right now.
- zionic 6y agoThis is brilliant, I too feel like there’s an opportunity there but don’t have any idea off the top of my head how to implement such a thing.
- voldacar 6y agomaybe you could encode the number of maximum nested loops into the type system, so when defining a function you set a maximum number which would fail to compile if exceeded? would be crude but possibly helpful at times