code-golf / code-golf

A game designed to let you show off your code-fu by solving problems in the least number of characters.
https://code.golf
MIT License
1.15k stars 106 forks source link

Show solution runtime #592

Open JRaspass opened 2 years ago

JRaspass commented 2 years ago

Add a column/hover text for solution runtime, we could use emojis to show which band they fall into, :turtle: :rabbit2: :zap: etc.

Do re-tests update it? Do we just store the lowest seen? What about lang updates? etc.

SirBogman commented 2 years ago

I would display a timer that starts counting up right when you start running a solution. Maybe also keep the one most recent time.

JRaspass commented 2 years ago

I'm toying with these emojis, but I don't know if we want a less linear scale, I worry pretty much all solutions will be under the 1s mark (for competent interpreters)

⚡ 0-1 secs (270,000 mph) 🏎️ 1-2 secs (200mph) 🦅 2-3 secs (100 mph) 🐇 3-4 secs (35mph) 🏃 4-5 secs (28mph Usain Bolt) 🐢 5-6 secs (0.6mph https://www.guinnessworldrecords.com/world-records/77951-fastest-tortoise) 🐌 6-7 secs (0.03mph)

JRaspass commented 2 years ago

As for when we update I'm come up with a sane solution. If the code and a hash remain the same we'll take the lowest figure of the current runtime and the value currently in the db.

The hash will contain any factors we feel could affect the runtime, and can easily be added in future, to start with I'll use the CPU model, the version of the language used, and a hash of the source of the hole or maybe some kind of internal version for the hole that we bump if if changes significantly.

Couple this system with automatic retests and eventually we have up-to-date runtimes for each solution.

SirBogman commented 2 months ago

I would say just show either one or two significant digits. Where are you proposing to add this info, rankings/holes?