Is there any winning criteria on the site which prioritises faster code instead of shorter code? My curiosity comes from questioning if size is better than efficiency or vice-versa. I know that using different computers to time different submissions can be difficult to objectively and fairly compare answers, but is it possible to use something like Try it online! (which includes execution times) instead?
1 Answer
fastest-code/fastest-algorithm
fastest-code challenges are, as the tag suggests, about creating the code to complete a task as fast as possible. Challenges with this tag should include the specifications of the machine being used to time the submissions (typically the challenge author's machine).
fastest-algorithm challenges are about the asymptotic time complexity of the answers, where the answer with the smallest such is the winner.
Note that both of these challenges should generally involve "tricky" tasks, as the margin of error for trivial tasks often overshadows the time taken to do that task itself (e.g. "add 2 numbers" would not be a good fastest-code challenge)
Additionally, while it is tempting to use TIO to time answers, it generally isn't a good idea. TIO uses multiple arena servers, which don't all run at the same speed, and your timing can be affected by other users running code at the same time
-
1
-
1\$\begingroup\$ @MartinPrado If my answer answers your question, feel free to click the green checkmark underneath to accept it :) \$\endgroup\$– caird coinheringaahin g ModMay 22, 2021 at 17:28