It is currently Fri Jul 20, 2018 2:11 pm Advanced search

Language performance

Random stuff about the contest, posts that don't fit in the other forums.

Language performance

Postby boinst » Wed Feb 10, 2010 4:20 am

Has anyone had a chance to evaluate how the different languages perform relative to one another? I'm wondering, for example, if a C++ program could squeeze more into a 1 second evaluation than a C# or a java program?
boinst
Cadet
 
Posts: 4
Joined: Wed Feb 10, 2010 2:05 am

Re: Language performance

Postby dhowden » Wed Feb 10, 2010 4:58 am

I'd be blown away if it didn't. (And would suspect that something weird is going on server side)
User avatar
dhowden
Cadet
 
Posts: 5
Joined: Fri Feb 05, 2010 4:03 am
Location: Australia

Re: Language performance

Postby boinst » Wed Feb 10, 2010 6:04 am

I notice that the top ranking entries are C++ and python, but there's a C# not far down...
http://csclub.uwaterloo.ca/contest/rankings.php
boinst
Cadet
 
Posts: 4
Joined: Wed Feb 10, 2010 2:05 am

Re: Language performance

Postby dutchflyboy » Wed Feb 10, 2010 1:52 pm

Well, it depends on how good you are with the language. C# is, for example, a compiled language -> quite fast. But it has a garbage collector. This means you can't make any mistakes for that part (no overflows), however, C++ will probably be slightly faster. This advantage disappears if you have a memory overflow and your program crashes (not likely, but you never know).

Java on the other hand isn't completely compiled. It's also very fast, but as it requires a VM, it often takes longer to start up.

But I think you should choose the language in which you feel comfortable: a faster language won't beat a better algorithm.
dutchflyboy
Colonel
 
Posts: 57
Joined: Sun Feb 07, 2010 1:08 am

Re: Language performance

Postby boinst » Wed Feb 10, 2010 11:21 pm

OK, thanks for the thoughts!
boinst
Cadet
 
Posts: 4
Joined: Wed Feb 10, 2010 2:05 am

Re: Language performance

Postby tdeluca » Thu Feb 11, 2010 1:27 am

Proof by anecdote:
I implemented a bot in scheme and again in python.
The python bot took around 3/5 the time of the scheme bot to choose a move in my tests.
YMMV.
tdeluca
Cadet
 
Posts: 7
Joined: Sun Feb 07, 2010 5:45 pm

Re: Language performance

Postby samadam » Thu Feb 11, 2010 2:44 am

It's definitely got to be more weighted toward the algorithm, because python is pretty much the slowest language on there (with ruby), and C++ is the fastest, and they are competing head to head.
samadam
Lieutenant
 
Posts: 14
Joined: Sat Feb 06, 2010 11:13 pm

Re: Language performance

Postby pgpaskar » Fri Feb 12, 2010 5:56 am

The implementation is also very important. A very good implementation of the same algorithm in a functional language can compete quite well as one in an OO language and procedural language. However, if the code is sloppy or biased towards a certain style, the results will be skewed. Of course a very low level language like C will be able to perform brute calculations somewhat faster, it won't necessarily beat the other languages when using an algorithm that becomes exponentially slower with greater depth (such as minimax) or one that has a great advantage using facilities that C doesn't do so well at (like self-modifying code). You must also consider the fact that there /are/ better strategies than brute minimax in a lot of situations (such as when minimax can't predict anything useful yet!). People who implement these in addition to strong close-quarters algorithms are going to be the ones who sit atop the leader board. There doesn't exist a single solution to this game (if there did, this would be a trivial challenge). It is about being smart on both your algorithm selection and implementation.

;)
User avatar
pgpaskar
Lieutenant
 
Posts: 13
Joined: Mon Feb 01, 2010 1:24 am

Re: Language performance

Postby riffraf » Fri Feb 12, 2010 11:06 pm

Regarding Python and C++ being on top - don't forget that those are the most popular submission languages. Also, there may other correlations - Lisp programmers might be more interested in AI than ruby programmers, for example. Of course, it is still an interesting question which language is best suited for this challenge. I suspect it would be more interesting if the challenge were shorter (a couple days long, say).

Personally, I'm just using Python to prototype. If I have time I'll rewrite in a faster language. I expect there are many other people doing the same thing.
riffraf
Cadet
 
Posts: 1
Joined: Fri Feb 12, 2010 10:08 pm


Return to Misc

Who is online

Users browsing this forum: No registered users and 1 guest

cron