OCUK Xmas Programming Challenge

First submission

Hi,

Just submitted my attempt. Looks like I could be entry 13!

Mine is c# .Net 4 and runs in just under one second.

Merry XMAS to all readers

Mark
 
If you see it as work don't do it - it's a programming 'fun' challenge... not really about the money.

i work 9-5 every day mon to friday coding all day long. when i go home i dont code for free.

Anyways i dont want to derail this thread any further so i will wish you all luck in this challenge.
 
Runs in 0.060 seconds without threading and 0.015s when compiled against boost_thread-mt. Crazy fast :p

Nice, I wonder where the bottleneck is though since my laptop with a 2Ghz Core 2 Duo does it in 70ms without threading about 40ms with threading. Is optimisation on?
 
Hi,

Just submitted my attempt. Looks like I could be entry 13!

Mine is c# .Net 4 and runs in just under one second.

Merry XMAS to all readers

Mark

Thanks, recieved and working. Runs in 0.713 seconds :)

Nice, I wonder where the bottleneck is though since my laptop with a 2Ghz Core 2 Duo does it in 70ms without threading about 40ms with threading. Is optimisation on?

Hmm not much of a bottleneck? 60ms no threading and 15ms with threading. That is without GCC optimizations though yes.
 
What are GCC optimizations?

GCC is the Linux C/C++ Compiler and you can ask it to spend extra time optimizing your code during compiling to make it as fast as possible. There are 3 levels of optimizations avaliable, for example the highest does:

This option turns on more expensive optimizations, such as function inlining, in addition to all the optimizations of the lower levels -O2 and -O1. The -O3 optimization level may increase the speed of the resulting executable, but can also increase its size. Under some circumstances where these optimizations are not favourable, this option might actually make a program slower.

Won't be using it here though as not sure it's very fair towards other bulky languages (.net or python).
 
Thanks, recieved and working. Runs in 0.713 seconds :)



Hmm not much of a bottleneck? 60ms no threading and 15ms with threading. That is without GCC optimizations though yes.

Ah, well that explains it. Performance is in line with what I'd expect from no opimitisations, only got about 170ms with no threading with that.
 
Finally submitted my entry. It runs in around 160ms when compiled for x64 using C#/.NET 4. I'd mainly written it with re-usability in mind rather than for all out performance, I could squeeze a bit more out of it by going from Int64s to ints but that kills the re-usability a bit :p.

This was my first time using Visual Studio 2010, it's much nicer than 2008.
 
Finally submitted my entry. It runs in around 160ms when compiled for x64 using C#/.NET 4. I'd mainly written it with re-usability in mind rather than for all out performance, I could squeeze a bit more out of it by going from Int64s to ints but that kills the re-usability a bit :p.

This was my first time using Visual Studio 2010, it's much nicer than 2008.

Thanks, all working :) I get it at 125ms on x64.

Also, awesome christmas tree ;)
 
Got it all running in <60Sec. Going to try and pull it down a little further. I kind of left this for a while and while I was doing something I kind of had an epiphany on how to do stage 1.
 
Yes its stage 1 that is killing my submission, it takes 95% of the 700ms to complete. I did try one slight epiphany moment but it seemed to make little difference, which surprised me. I may try continuing with with that thought because it seemed sound.

Looking forward to seeing the source code of the other entries. ;)
 
Spurred on by 7e7en having an epiphany moment I thought I had better have one too. So i have just sent in submission #2.

WOW overall result now 78ms. Stage 1 is 20 times quicker ;)
 
43.695 Seconds on a Intel Atom 1.6GHz. I'm sure I could squeeze a little more out of this.

57123625.png
 
Should part 9 take 15mins plus? I've sent mine going and its still not finished yet it works correctly with a lower limit but with 2.5million its still chugging away *I think as its taking a nice solid 25% of CPU time but only 1,736K of memory :confused:

PC spec Intel Q6600 @ 2.4Ghz with 4GB Ram.


Blackvault
 
Should part 9 take 15mins plus? I've sent mine going and its still not finished yet it works correctly with a lower limit but with 2.5million its still chugging away *I think as its taking a nice solid 25% of CPU time but only 1,736K of memory :confused:

PC spec Intel Q6600 @ 2.4Ghz with 4GB Ram.


Blackvault

Mine only takes 1 or 2 seconds. I used stage 5 to generate the prime numbers for stage 9, then had a loop that added them all together.
 
Back
Top Bottom