4 ms·
Is there a tool where you can check how many instructions your program, with a set input, required to execute the task? Imagine this, given an x86 C/C++/Rust c
by brezelgoring 4y ago
Is there a tool where you can check how many instructions your program, with a set input, required to execute the task?
Imagine this, given an x86 C/C++/Rust compiler we all agree upon, and a set of inputs we also share, produce a program that counts - say - the median length of the arrays given or something. After which we'll run our programs in a profiler of sorts that tells us 'this program achieved the task in 1,104,687 cumulative instructions' and we'll compete based on that metric.
It wouldn't really matter what processor you use because the target is the same and so is the compiler.
Is what I suggest possible? It'd be a nice conciliation between platform independence and speed measuring.
- leirda 4y agoYeah, let's just agree on the used architecture, the compiler(s) version(s) and call it a day!
- 082349872349872 4y agolike sailboat classes
- brezelgoring 4y agoI know it is nonsensical for real world applications but golfing isn't real world programming, so why not eliminate some variance ourselves and try measuring what's left? Don't just laugh, try and tell me why this is not possible for you. This performance golf seems like an interesting idea.
- hayst4ck 4y agoDoesn't GDB allow you to step through code instruction by instruction? I imagine Ghidra or IDA Pro could be souped up to "referee" pretty reasonably. I would imagine in-lined assembly could circumvent any kind of compiler restriction (just compile it with an optimized compiler and inline the relevant assembly it produces).