Sometimes in the real world, you're in a situation where you need to run a program on a very specialized computer, and you don't care how long it takes to run, but the computer has very limited memory. So, rather than optimizing for speed, you have to optimize for low memory footprint.
The point of this challenge genre would be to pose challenges where getting a small program or a fast program may not be challenging, but trying to use as little memory as possible to solve the problem is an interesting goal.
Here are some examples of objective winning criteria for this genre:
- lowest peak memory usage
- lowest average memory usage
- lowest peak stack size (for stack-based languages; could be expanded to other languages by enforcing use of a stack for all memory allocation/deallocation; tape-based languages like brainfuck would have lowest maximal tape position)
More than likely, like fastest-code, the memory usage will be measured on the challenge author's computer. Luckily, there are some helpful tools and loads of useful SO/SE questions (1, 2, 3) to help the challenge author in measuring memory usage.
Additionally, some custom memory management tools/libraries could be written to get realtime information about memory allocation and deallocation (like by writing a custom
malloc function in C).
I propose the tag name for this genre be memory-golf.
Request for comments
- What other details/requirements would need to be added?
- What other winning criteria could be used?
- What issues are present in this proposal that my sleepy brain isn't catching?