-2
\$\begingroup\$

So, I thought about a new metric of code-golf, the code with the smallest value wins. The value is calculated by characters*time to run. So if you use an programming language like python, it's very short, but for that reason, it's less efficient. This results in a chance for efficient programming languages, which take more chars. My question is :

How can we measure efficiency/time to run ? Everybody's got a different setup.

How could we call this new type of code-golf ?

\$\endgroup\$
  • 3
    \$\begingroup\$ This is not good IMO as we are yet to come to a consensus for fastest-code. This is because timing will always be different on different setups. Plus, it's not hard to make a fast golflang so it's pretty much pointless anyway. \$\endgroup\$ – ASCII-only May 27 '17 at 11:00
  • \$\begingroup\$ @ASCII-only : A efficient programming language needs to be strongly typed, what means more chars. \$\endgroup\$ – LMD May 27 '17 at 11:04
  • 1
    \$\begingroup\$ It doesn't need to be, implicit typing exists, plus it can still be very fast even without strong typing \$\endgroup\$ – ASCII-only May 27 '17 at 11:04
  • \$\begingroup\$ @ASCII-only : Probably we could measure efficiency using online-interpretors like Tutorialspoint offers ? \$\endgroup\$ – LMD May 27 '17 at 11:05
  • 1
    \$\begingroup\$ Wait true, TryItOnline exists for PPCG \$\endgroup\$ – ASCII-only May 27 '17 at 11:06
  • \$\begingroup\$ @ASCII-only : Where can I find it ? \$\endgroup\$ – LMD May 27 '17 at 11:41
  • 1
    \$\begingroup\$ tio.run (execution time is in debug folder, or you can time from any shell) \$\endgroup\$ – ASCII-only May 27 '17 at 11:42
  • 1
    \$\begingroup\$ Yes one metric can be (n characters) * O(algo). Because all algo has its big O number... the problem it is only to find the difference if O(f) == O(g)... Possible one can load and execute in Tio for see what is more fast? \$\endgroup\$ – RosLuP May 27 '17 at 14:06
  • 1
    \$\begingroup\$ Plus Big O complexity is a number, plus that would be a different tag (the fastest-algorithm equivalent of this) \$\endgroup\$ – ASCII-only May 27 '17 at 22:55
  • 1
    \$\begingroup\$ @ASCII-only The downside to TIO is that there's a 60-second time limit on execution. I'd imagine that most interesting tasks would take longer than 60 seconds on TIO. \$\endgroup\$ – Mego May 28 '17 at 3:22
  • \$\begingroup\$ 60 second are enough because one can act on arguments of input make them smaller \$\endgroup\$ – RosLuP May 28 '17 at 12:53
-2
\$\begingroup\$

What is the appropriate metric for a program? Yes there is the length of the program, there is the fast run, there is the error detection and secure and in range result, but first of all that, the more important of the first 3: There is the readability... I'm not agree with the ones see program as a min text to run(even if I like synthesis and in 90% cases have good results in synthetises), but either I not agree in see a program as a novel we have to read in English or in the language one is born. It is for me as read mathematical formulas, it is a language different from the one we usually speak (English, Danish, Italian, ...). If they want a better way for question and answer for me:

1) the question has always to speak and request the limits cases on answers (for to see if error way is ok for all (or almost all) input possible) 20% of the vote should be for this point, the error path

2) each variable name or operator name or function name, or type name ecc value is 1 character; the prototype of a function example "char g(char * v)" is 0 character each comment is -1 character 40% of the vote would comprehend this point, the code length

3) the fast code in one external machine for see the speed of the code 10% of vote would regard this aspect, the fast code

4) the vote of people (for readability and easy read and smart solutions) 30% of vote would regard this aspect, readability

\$\endgroup\$
  • \$\begingroup\$ Yes, but this is code-golf. The question is:whose implementation is shortest, who has got the best algorithm. But how good an algo/its implementation is, has to be also measured on his efficiency. \$\endgroup\$ – LMD May 28 '17 at 17:26
  • \$\begingroup\$ the best algo can be very long... \$\endgroup\$ – RosLuP May 28 '17 at 20:48
  • \$\begingroup\$ Yes, but then it may be more efficient. \$\endgroup\$ – LMD May 29 '17 at 20:25
  • \$\begingroup\$ If there is a problem of efficiency for me: Is more important the speed than the length of the code; if problem is not speed count more length of code and readability. I think that code return the right answer, and a good error path (for find errors) are important. And it is important too prefer always algo that has big O... little \$\endgroup\$ – RosLuP May 29 '17 at 21:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .