PDA

Click to See Complete Forum and Search --> : Prime Numbers Discussion -[Results Included]-


Pino
Sep 28th, 2004, 04:26 AM
Ok you will all be gald to know me and the other moderators have began marking your entries! We will get the results to you as soon as we can :)

For now if you wish to discuss the contest or any of the entries which are now visible, please post here :)

PINO

wossname
Sep 29th, 2004, 03:35 AM
If you download my app, DO NOT open the form in the form designer, because that messes it up, instead right-click the form in the project explorer and then click <View Code>.

Then expand the regions to find my code.

Thanks to Mendhak for pointing this out. ;)

manavo11
Sep 29th, 2004, 07:56 AM
Originally posted by wossname
If you download my app, DO NOT open the form in the form designer, because that messes it up, instead right-click the form in the project explorer and then click <View Code>.

Then expand the regions to find my code.

Thanks to Mendhak for pointing this out. ;)

Took me a while to realise :mad: :p

EricDalnas
Sep 30th, 2004, 03:56 PM
The waiting is killing me. Did I make at least second to last or what?!

Pino
Sep 30th, 2004, 04:48 PM
hehe! wont be long now and we will get the results to you :)

mendhak
Oct 1st, 2004, 05:40 AM
... said the evil 666 squirrel...

RobDog888
Oct 1st, 2004, 09:18 PM
How about posting what you got so far and posting the rest
as you finish them???

wossname
Oct 2nd, 2004, 06:25 AM
Come on mods! Where's my result? Haul ass guys, it doesnt take a whole week to test this many entries.

*Whip sound effects*

Pino
Oct 2nd, 2004, 07:27 AM
Results Are In!!!

VB . Net Entries


Name Mark
______________________
nokia8210 44
lesssalter 50
ericdalnas 60
digiesh 64
ntg 68
arun.ns 69
space.27 74
mendhak 79
wossname 99 <<< Winner!!!!



Thanks for everyone who entered! And well done to wossname :)

VB 6 Entries



Mark Name
__________________
VbasicGirl 33
Acidic 37
BPD 38
NotLKH 39
Cyborg 39
Riis 46
RobDog 55
BodwardUK 59
StephenHickerson 63
Ex-FB 65
Dsheller 68
Merri 74
NoteMe 78
SeniorBadger 85
Dave Sell 92 <<< winner
__________________



Thanks for everyone who entered! And well done to Dave Sell :)


:)

TheVader
Oct 2nd, 2004, 07:32 AM
(errr, *cough* you'd better spell Bodwad's name correctly, before he reads this.... :lol: )

mendhak
Oct 2nd, 2004, 07:49 AM
Bodwad just PWND EVERYONE'S butts!!

W00t!!!!!!!!

:afrog:

Pino
Oct 2nd, 2004, 07:53 AM
:) my appoligise for incorrect names i'll try and get them fixed :)

and yes bodwards entry was VERY good but davesell was also very close to taking gold :)

Electroman
Oct 2nd, 2004, 08:52 AM
Posted by Pino
:) my appoligise for incorrect names i'll try and get them fixed :)

and yes bodwards entry was VERY good but davesell was also very close to taking gold :) :lol: I edited it to correct it then you edited it and made it say BodwardUK again :lol:

wossname
Oct 2nd, 2004, 09:38 AM
Good competition everyone :)

Very enjoyable.

What was the prize? I've forgotten.

Ex-FB
Oct 2nd, 2004, 10:15 AM
Congratulations chaps! And thanks it was great fun to do!

NotLKH
Oct 2nd, 2004, 11:34 AM
Originally posted by wossname
Good competition everyone :)

Very enjoyable.

What was the prize? I've forgotten.
1000 Postcounts to the top dogs,
300 to the to the top 50 %
100 to the last place winners.

and Kudos to the Judges!!!


:wave:

RobDog888
Oct 2nd, 2004, 01:18 PM
Congratulations to BodwadUK and wossname on winning!

NotLKH, the prize is a temporary custom title of something
like "Contest Winner" I think.

NoteMe
Oct 2nd, 2004, 02:31 PM
Bodwad for Prime Minister....:D

StevenHickerson
Oct 2nd, 2004, 03:47 PM
Stephen... arg.. I hate that spelling!

At least I didn't do as bad as I thought.. although I wish you would've posted average timings rather than just marks. I was more interested in seeing everyones times lol. Oh well guess I can go download everyones.

Pino
Oct 2nd, 2004, 04:40 PM
Originally posted by StevenHickerson
Stephen... arg.. I hate that spelling!

At least I didn't do as bad as I thought.. although I wish you would've posted average timings rather than just marks. I was more interested in seeing everyones times lol. Oh well guess I can go download everyones.

changed it for you :)

Ex-FB
Oct 2nd, 2004, 08:36 PM
Er, Just out of curiosity how was the marking weighed between speed and design.


Because I was fascinated to see how badwad had done it.... but when I time his app I get about 210 milliseconds.....


When I time mine I get 15 milliseconds....

I used the high resolution timer.

I'm not complaining, I'm just really interested in the performance tuning, and if there's maybe a faster one that he re-posted that isn't in the original forum could you publish it for us.

Thanks!

NoteMe
Oct 2nd, 2004, 09:35 PM
The problem is that the diffrent apps gives diffrent times on the diffrent machines....like my app that was 4 times slower on Electromans PC, that is supposed to be at least 3 times faster then my machine....

Ex-FB
Oct 2nd, 2004, 10:00 PM
Yes, but the speeds should remain proportional to each other roughly?

NoteMe
Oct 2nd, 2004, 11:22 PM
Not nesessery...not if a CPU is missing a instruction set an have to emulate something that an other CPU have....then the code that need that instruction set is but ****ed...

Ex-FB
Oct 2nd, 2004, 11:50 PM
Mmm - I'm sceptical. No offence to Bodwad, but I don't see any optimisation. A quick check show's that the code he posted is doing something in the order of 1,000,000 calculations, in comparison mine is doing about 5,000..... I'm not saying mine is anything great, but I don't see how this code could be faster. I honestly suspect that this is maybe his first attempt (as I got it out of the entries forum), and I'd just like to see what the winning code was so I can learn from it.

Ex-FB
Oct 2nd, 2004, 11:54 PM
Besides, the only isntructions I'm using are +, - and *, I doubt if any of those would be emulated :p

Pino
Oct 3rd, 2004, 05:38 AM
Ok, firstly please remember the FAQ, contests are for fun :)

secondly bodwads ran Faster than yours on my machine, quite a bit faster!

Bodwad recieved the highest speed mark, I'm not going to go into details about who got what for which aspect, i dont want to start arguments! (And thats what the mods and me have agreed to just display the final mark :))

Your entrie was very good :) and thanks for entering

wossname
Oct 3rd, 2004, 09:17 AM
Which language won in the speed stakes? VB6 or VB.Net? IE what was the millisecond difference between bodwad's entry and mine?

Still waiting for my prize by the way.

Will it be accessible via the User CP pages?

Ex-FB
Oct 3rd, 2004, 09:57 AM
Originally posted by Pino
Ok, firstly please remember the FAQ, contests are for fun :)

secondly bodwads ran Faster than yours on my machine, quite a bit faster!

Bodwad recieved the highest speed mark, I'm not going to go into details about who got what for which aspect, i dont want to start arguments! (And thats what the mods and me have agreed to just display the final mark :))

Your entrie was very good :) and thanks for entering

Don't get me wrong, I'm just curious to learn about what improvements could be made. That's why I'm so fascinated by the discrepencies, could you check that the version of the code in the forums is his latest version, I'm just asuming that I've picked up an old version of the code, as I cannot see anyway the posted code would run at any great speed at all.

If it is the correct code, out of interest what sort of machine are you running it on, because so far I've ran it on three of my different machines (An Intel P4 2.4gig, an AMD 1800+ and an AMD 600) with all the same results. Either I'm missing something hugely here, or it's the wrong code or there's something very strange happening internally withthe processors (which I would love to find out about - as like most programmers I delve into games programming for fun quite a lot and every ounce of speed that can be eeked out of algorithms is useful). Thanks.

NoteMe
Oct 3rd, 2004, 11:17 AM
Well was the test in the IDE or as EXE? Well I tested My code, Ex-FBs code and Bodwads code in the IDE on my machine and I got these results...:D



Bodwad: 0.21177 sec
Ex-FB: 0.00580 sec
NoteMe: 0.00567 sec


HEhehe....how did he win....:D...ohh....Ex-FB can you test my code against yours on the machine?

Ex-FB
Oct 3rd, 2004, 01:02 PM
No problem mate!

In IDE

BodWad: 205 ms
Ex-FB: 11 ms
NoteMe: 8ms

Compiled

BodWad: 61ms
Ex-FB: 11ms
NoteMe: 7ms


Excellent job :thumb:

though you must have missed electromans rule change ("My first reaction was that the rules already said one per line and I then checked and saw it wasn't in. I then said well if it is allowed then it would loose points for appearance unless it was done very well with proper indenting or something like that. And as you can see after checking with others the change was made.") *cough*

:p

Look, I loved this contest, and I don't actually care about the prize or winning, but I am quite concerned about a game I'm working on right now which is highly optimised for 3d calcs. I don't want to find oiut that it is going to run like a dog on a certain type of processor.

NoteMe
Oct 3rd, 2004, 01:52 PM
So my code is the fastest one...:D..well nice of me...:D....ohh....and if you look at it...it is only one on each line...;)...I just used 4 colums...;)...so the list didn't wasn't that long...there is NOOOO speed gain...just a visual improvement...;)

Ex-FB
Oct 3rd, 2004, 01:56 PM
There's a massive speed gain. :p If you cange it back to 0 columns your back up at 13ms. (12ms compiled) :p :thumb: But well done anyway, a much cleaner bit of code than mine. Nice one.

NoteMe
Oct 3rd, 2004, 02:48 PM
Well maybe it is only on my machine you don't get a gain then....I just tested it again....and I got 0.1 ms faster on one column then 10...:D

Ex-FB
Oct 3rd, 2004, 02:51 PM
Did you set the column value to 0? because with 1, you still get columns......

Ex-FB
Oct 3rd, 2004, 02:54 PM
Anyway, it doesn't matter, I think I've found the problem with my code, I was doing something silly, and luckily it's easy for me to change in my game code. So it's probably best to just move on.

Congratulations to all involved, I had great fun. Unfortunately I've been waaaaay to busy to get involved with the maze competition (although I think it'd be great fun), but I'm hoping to get some time for the next one.... Good luck to all you maze-tracking folk! :thumb:

NoteMe
Oct 3rd, 2004, 02:55 PM
Yes I did...and even if I didn't I can't see how it should gain speed, it is just the rendering of the list box that changes. You still have to call Add just as many times...

StevenHickerson
Oct 3rd, 2004, 03:26 PM
I used 5 columns on my listbox.. it greatly enhances speed when adding to the listbox. Dont ask me why it does but it does. I would think it might have something to do with the redrawing of the listbox in windows but I dont see why its redrawing while invisble (which mine was set to when adding).

*shrug*

RobDog888
Oct 3rd, 2004, 04:21 PM
I used a single column so it would put one prime per line. I thought
that was how it was supposed to be according to the rules?

:(

NoteMe
Oct 3rd, 2004, 04:32 PM
The rules was trying to make you call Add 1000 times in stead of just a few. So you where not allowed to concatinate strings...;)

RobDog888
Oct 3rd, 2004, 04:36 PM
Guess the Mods missed declaring that one. Oh well. Next time.
Still did better than I thought I would.

Later.

NotLKH
Oct 3rd, 2004, 08:00 PM
Understand all, I have a slow machine!!!
Anyways, so far...

My Results, with Q's:

NoteMe: initApp??? What da heck is THAT???:D

Anyways,:
Noteme: .0151 Seconds {compiled}

Bodwad:

Hmmm, Being "Visible=false" Is a form Prop.

Interesting...
Hmmm, I test with a hundred loops. Bodwads still going!!! {IDE MODE} {KILL IT!!!}
Ummmh, Form1.Caption slows thigs down enormously!!!

My Timed Bodwads is .4221 seconds, average. {compiled!!!}

Ok. Now EX_FB...

1 moment please. I'm going to double check, once I do FB's, but I need a smoke.
Hey, Mendhak!!! Bring the Fire!!!

:D

NotLKH
Oct 3rd, 2004, 08:17 PM
EX_FB:
.1128 Secoinds, compiled.


Alrighty then.

Hey, Ex, Note, Bodwad,

Whats My Time???

http://www.vbforums.com/attachment.php?s=&postid=1797398

NotLKH
Oct 3rd, 2004, 08:30 PM
Hey, Jala,

Just making sure, JIC Ex_VB is correct.
This IS my code you tested, isn't it???



'on your "start"
call BUILD_THEM

'and then, on a bas:


[Highlight=VB]
Option Explicit

Dim MyI As Integer
Dim MyJ As Integer
Dim MyK As Integer

Dim MyUL As Integer
Dim MyTopmost As Integer
Dim MyRoot As Integer

Dim MyNumbers(999) As Integer
Public Sub BUILD_THEM()
'Assumptions: since 1 is not a prime, and since the only whole positive Integer below 2 is 1, then
'2 is the first prime
'also, I will assume, since this is going to be timed,
'that I must handle clearing the output listbox within the sub
'that also outputs to the listbox.

Form1.Enabled = False
Form1.lstMyPrimes.Visible = False
Form1.lstMyPrimes.Clear

'to be fair, if this is going to be timed, in a loop,
'I should make sure that MyNumbers are all initialized to 0

For MyI = 0 To 999
MyNumbers(MyI) = 0
Next MyI
MyNumbers(0) = 2

MyI = 0
MyJ = MyNumbers(MyI) + 1
MyTopmost = 0
MyUL = (MyNumbers(MyTopmost) * MyNumbers(MyTopmost)) - 1
MyRoot = 1
Do While MyI < UBound(MyNumbers)
MyK = 0
If MyJ > MyUL Then 'seems to be faster than calculating sqr(myj) over and over
MyRoot = MyNumbers(MyTopmost)
MyTopmost = MyTopmost + 1
MyUL = (MyNumbers(MyTopmost) * MyNumbers(MyTopmost)) - 1
End If
MyI = MyI + 1
MyNumbers(MyI) = MyJ
Do While MyNumbers(MyK) <= MyRoot
If MyJ Mod MyNumbers(MyK) = 0 Then
MyI = MyI - 1
Exit Do
End If
MyK = MyK + 1
Loop
MyJ = MyJ + 2 'only test the odd, since all even are divisible by 2, and 2 is prime
Loop
'well, can't do this anymore!
'For MyK = 0 To 990 Step 10
' For MyJ = 0 To 9
' MyParts(MyJ) = CStr(MyNumbers(MyK + MyJ))
' Next MyJ
' Form1.lstMyPrimes.AddItem Join(MyParts, " ")
'Next MyK
For MyK = 0 To 999
Form1.lstMyPrimes.AddItem CStr(MyNumbers(MyK))
Next MyK


Form1.lstMyPrimes.Visible = True
Form1.Enabled = True

End Sub

BodwadUK
Oct 4th, 2004, 03:12 AM
Wohoo thats a shock.


I did resubmit the code with alot of changes BTW :D

Your all sore losers, You also forget I am king and therefore must win or the winner would have to be executed for treason :afrog:

NoteMe
Oct 4th, 2004, 05:05 AM
Originally posted by NoteMe



IDE:

Bodwad: 0.21177 sec
NotLKH: 0.01567 sec
Ex-FB: 0.00580 sec
NoteMe: 0.00567 sec



Compiled:

Bodwad: 0.0530 sec
NotLKH: 0.00571 sec
Ex-FB: 0.00485 sec
NoteMe: 0.00417 sec



ADded you NotLKH to my times...

NoteMe
Oct 4th, 2004, 05:14 AM
Can't understand how that dog won with 10-40 times slower code then us...:D....where are your resubmitted code....

BodwadUK
Oct 4th, 2004, 06:10 AM
:rolleyes:

Think this is it. its the one on my desktop :afrog:

cyborg
Oct 4th, 2004, 06:31 AM
Hey! Could you compare my code too? I think it was pretty fast! Somewhere under 10 ms at least. I don't understand how my code could get that low points. It was a clean, smart and fast code, and pretty well commented.

NoteMe
Oct 4th, 2004, 06:41 AM
I will test both your codes when I get home. I am atschool now...

BodwadUK
Oct 4th, 2004, 06:41 AM
The judges decision is final and cannot be changed. (I Hope :afrog: )

NoteMe
Oct 4th, 2004, 06:50 AM
Well lets wait and see....looks like Pino is in exile....;)

Merri
Oct 4th, 2004, 07:54 AM
I wonder what really counted in the contest results, after seeing the top three. Atleast speed didn't matter much. Design didn't matter much (all three had only a button and a listbox - very original). Maybe I should have spent only two hours on it and keep it simplistic, since that's what seemed to count.

Tired from a several days long trip. But would be nice to know how the points were actually given.

BodwadUK
Oct 4th, 2004, 08:42 AM
It might have been code layout and complexity. Use of prefab functions might reduce score etc. Dont know really. :)

NotLKH
Oct 4th, 2004, 08:47 AM
Hey, Noteme,
Think you could also do an average time on 100 iterations of the codes? I've noticed on some of the codes that times increase during multiple calls, perhaps due to inefficiencies in reinitializing the setup, while others decrease.

And throw merris into the mix, if you have a chance.
:wave:

BTW, Merri, Nice code!
I thought multiple columns weren't allowed, but still it looks nice!
:)

NotLKH
Oct 4th, 2004, 08:49 AM
Originally posted by BodwadUK
...Use of prefab functions...
http://www.vbforums.com/attachment.php?s=&postid=1797398

Such As, IYHO?


:)

BodwadUK
Oct 4th, 2004, 08:55 AM
Such as format, Sin, Cos, replace, split

etc etc

I dont know if anyone used them I am just saying its possible :)

NotLKH
Oct 4th, 2004, 09:36 AM
Is this an accurate assesment of the assumptions made in our codes:


Bodwad: "Assumes" 2 is prime so tests only odd, does not assume end boundary. +1
Ex_FB: "Assumes" 2 is prime so Tests only odd, Assumes 1000 primes by 7919. +2
NoteMe: "Assumes" 2 is prime so Tests only odd, assumes 1000 Primes by 7919. +2
Merri: "Assumes" 2 is prime so Tests only odd, assumes 1000 Primes by 7919. +2
NotLKH: "Assumes" 2 is prime so tests only odd, does not assume end boundary. +1
David: "Assumes" 2,3,5 are prime, does not assume end boundary. +3
Badger: Tests 2, but does test assume 2 is prime?*, does not assume end boundary. +0
:wave:

* You decide: Call is made to test 2 thru the following:


Function isprime(mynum As Long) As Boolean
Dim a As Long
For a = 2 To (mynum - 1)
If mynum Mod a = 0 Then
isprime = False
Exit Function
End If
Next a
isprime = True
End Function

NoteMe
Oct 4th, 2004, 10:10 AM
Originally posted by NotLKH
Hey, Noteme,
Think you could also do an average time on 100 iterations of the codes? I've noticed on some of the codes that times increase during multiple calls, perhaps due to inefficiencies in reinitializing the setup, while others decrease.

And throw merris into the mix, if you have a chance.
:wave:

BTW, Merri, Nice code!
I thought multiple columns weren't allowed, but still it looks nice!
:)


WEll would love to do that too...but not sure if I have the time...at least not now....and BTW the way you are getting faster results that way on some apps and slower on others is the cache layout. Depends on how much cache you have, what kind of level they are and how they are sorted, and of course the most obvious of them, cache misses, and trashing...;)

NoteMe
Oct 4th, 2004, 10:22 AM
Update:


Originally posted by NoteMe


The way it is tested. It is tested on a 1900+ machine both compiled and in the IDE. I am running the test 5 times, and the time under here, is the average og test 2-5.

IDE:

Bodwad2: 0.21540 sec
Bodwad: 0.21177 sec
Cyborg: 0.02351 sec
NotLKH: 0.01567 sec
Merri: 0.00629 sec
Ex-FB: 0.00580 sec
NoteMe: 0.00567 sec



Compiled:

Bodwad2: 0.05478 sec
Bodwad: 0.0530 sec
Cyborg: 0.00959 sec
NotLKH: 0.00571 sec
Ex-FB: 0.00485 sec
Merri: 0.00467 sec
NoteMe: 0.00417 sec

NoteMe
Oct 4th, 2004, 10:30 AM
Well congratulation to Merri...his code was realy fast. And Bodwads code is still slow as hell...:D....his code is not even in a module....shot him...:D

ntg
Oct 4th, 2004, 10:59 AM
Hi,

Gongrats to the winners :thumb: and thanks everyone for an enjoyable contest.

BTW, I think it's completely lame to just post overall marks without a basic breakdown (speed of algo, overall speed, code readability, negative points for assumptions, error handling or whatever).

Cheers,
NTG

BodwadUK
Oct 4th, 2004, 11:13 AM
Hey stop complaining I won :afrog:

BodwadUK
Oct 4th, 2004, 11:13 AM
Did you use the same timing module noteme? :afrog:

wossname
Oct 4th, 2004, 11:46 AM
99/100 read it and weep.

NoteMe
Oct 4th, 2004, 12:56 PM
Originally posted by BodwadUK
Did you use the same timing module noteme? :afrog:


Off course I did.....look who posted it.....;)

Electroman
Oct 4th, 2004, 04:46 PM
NoteMe I told you yestaday that there was a mistake when Bodwad's code was tested. I thought Pino would have annouced it offically by now though :confused:.

NotLKH
Oct 4th, 2004, 04:55 PM
Then do the times of those that Noteme list seem to accurately correspond with the actual testing results?

Electroman
Oct 4th, 2004, 04:58 PM
Posted by NotLKH
Then do the times of those that Noteme list seem to accurately correspond with the actual testing results? I couldn't say but I know that the timing problem only effects bodwad, so the other rankings will keep its order just Bodwad will move down the list :).

Pino
Oct 4th, 2004, 05:07 PM
sorry for delay i had to re-test everyones code again,

firstly let me appoligise for this!

the results have changed slightly because of a mix up with the timing n Bodwads entry! the Vb.net entries are fine, but the VB6 ones have changed ever so slightly!



VbasicGirl 33
Acidic 37
BPD 38
NotLKH 39
Cyborg 39
Riis 46
RobDog 55
BodwardUK 59
StephenHickerson 63
Ex-FB 65
Dsheller 68
Merri 74
NoteMe 78
SeniorBadger 85
Dave Sell 92





again i am sorry for the mix up

NotLKH
Oct 4th, 2004, 05:15 PM
Hmmm.
As has been mentioned, how do those scores breakdown, since it was, although primarily going to be based on speed, other factors were going to be considered.

And, we ALL are dying to know the actual timings.

Is Bodwads actually that much faster than mine?


:)
-Just wondering
-Lou

PS:

Seems its an Olympic Moment.
Couldn't you let Bodwad keep his gold?
Be an Honorary CoWinner?

dogfish227
Oct 4th, 2004, 05:17 PM
they corrispond via the following equation:

y=1.45x^5 - 23.583x^4 + 137.42x^3 - 337.92x^2 + 305.63x + 11

where X is the speed and y is the score

view attachment for graph

NoteMe
Oct 4th, 2004, 05:24 PM
Bhahhhaa...I am number 3 now..::D

NoteMe
Oct 4th, 2004, 06:40 PM
Intresting update....thanks to NotLKH for noticing...;)

Now Dave Sell is on the test bench...;)


Originally posted by NoteMe


The way it is tested. It is tested on a 1900+ machine both compiled and in the IDE. I am running the test 5 times, and the time under here, is the average og test 2-5.

IDE:

Bodwad2: 0.21540 sec
Bodwad: 0.21177 sec
Cyborg: 0.02351 sec
Dave Sell: 0.20854 sec
NotLKH: 0.01567 sec
Merri: 0.00629 sec
Ex-FB: 0.00580 sec
NoteMe: 0.00567 sec



Compiled:

Dave Sell: 0.12635 sec
Bodwad2: 0.05478 sec
Bodwad: 0.0530 sec
Cyborg: 0.00959 sec
NotLKH: 0.00571 sec
Ex-FB: 0.00485 sec
Merri: 0.00467 sec
NoteMe: 0.00417 sec


'

How the hell did the slowest code on earth win....:D

NoteMe
Oct 4th, 2004, 06:49 PM
And with even more help from NotLKH.....We tested SeiorBadgers code, and we even optimised the command click event a bit....and it is still slower then my grandmother.....Pino...I refuse to belive that you tested all of the apps again after we pointed out that you did something wrong...:D


Intresting update....thanks to NotLKH for noticing...;)

Now Dave Sell is on the test bench...;)


Originally posted by NoteMe


The way it is tested. It is tested on a 1900+ machine both compiled and in the IDE. I am running the test 5 times, and the time under here, is the average og test 2-5.

IDE:

SeniorB: 0.41167 sec
Bodwad2: 0.21540 sec
Bodwad: 0.21177 sec
Cyborg: 0.02351 sec
Dave Sell: 0.20854 sec
NotLKH: 0.01567 sec
Merri: 0.00629 sec
Ex-FB: 0.00580 sec
NoteMe: 0.00567 sec



Compiled:

Dave Sell: 0.12635 sec
SeniorB: 0.11036 sec
Bodwad2: 0.05478 sec
Bodwad: 0.0530 sec
Cyborg: 0.00959 sec
NotLKH: 0.00571 sec
Ex-FB: 0.00485 sec
Merri: 0.00467 sec
NoteMe: 0.00417 sec

NoteMe
Oct 4th, 2004, 06:51 PM
If it was me who did this contest, I would have said it was more or less draw on the speed between Merri, Ex-FB and NoteMe. And voted the prettiest of those 3 codes as the winner, and added NotLKH as a goooood 4th.....well thats at least my 2 cent...

NotLKH
Oct 4th, 2004, 08:04 PM
Still Bodward?

Ex-FB
Oct 4th, 2004, 10:39 PM
In fairness, this was just a test competition. So how about we leave it and go on to the next one. One thing though I think we've learned is that if we're going to time a competition in future, then maybe the judges should provide the code for the timing module and make us put it in first. And all code has to go between the timer start and the timer stop (so no showing forms after the timer has stopped etc.)

I think as a test it has worked well and done it's job in ironing out the bugs in the system. I'm sure there will be more problems in future contests, but none of us should take this too seriously, it's a bit of fun, and it'll just keep getting better and better I'm sure, and eventually it'll run as smooth as clockwork.

Merri
Oct 4th, 2004, 11:09 PM
Btw, NoteMe, could you time so that you update my small mistake on my submitted code (really stupid, just didn't bother to submit updated code) and test the algo again?

Comment out D = A \ 2 lines, then set A \ 2 instead of D to the inner loop line between the out commented lines. This should speed up the algorithm code nicely. Silly mistake, but... :D

Hmm... looks like I'm the only one who made a flexible code. Nobody else seemed to allow to give almost any number to test to. And I got no bonus for doing so either.



Anyways, here is my test for the fastest algorithm (atm only me vs. NoteMe, for being fastest with the compiled code):


Merri: 0.020394 ms
NoteMe: 0.071517 ms


With this I mean the speed of the actual algorithm. No output to listbox and no initialization of the arrays or other variables included. Only the algorithm itself.


Tested/testing code for Merri (this is the slightly fixed version):


Set Q = New sTime
Q.Init
Q.StartTime

A = 3
B = 9
Do While B < Total
C = A + A
Do While B < Total
NumberTable(B \ 2) = True
B = B + C
Loop
A = A + 2
Do While NumberTable(A \ 2)
A = A + 2
Loop
B = A * A
Loop

Q.StopTime
MsgBox Format$(Q.RetTime * 1000, "0.000000") & " ms"


Tested/testing code for NoteMe:


Set Q = New sTime
Q.Init
Q.StartTime

For i = 3 To 7919 Step 2
If Not (IsComposite(i)) Then
For j = i To 7917 \ i Step 2
IsComposite(j * i) = True
Next j
End If
Next i

Q.StopTime
MsgBox Format$(Q.RetTime * 1000, "0.000000") & " ms"


I removed comments from the code to reduce length of the message. Tested machine details:

AMD Athlon XP 2200+ @ 1800 MHz
1024 MB DDR @ 333 MHz
ASUS A7N8X-VM/400 mini-ATX motherboard


Ex-FB: if you didn't notice, we're doing all this stuff at the moment for fun :D

Ex-FB
Oct 4th, 2004, 11:36 PM
Originally posted by Merri


Ex-FB: if you didn't notice, we're doing all this stuff at the moment for fun :D
:p Yeah, sorry I didn't mean to sound serious, just didn't want the competitions to stop becuase of all the complications.

And, if your really trying to compare speed of code, you should really both set your columns to zero as per the rules, seems I'm the only one who obeyed that ruling :p, or alternativly put my multi-column code back in... it knocks quite a chunk off on my machine...:thumb:

Merri
Oct 4th, 2004, 11:40 PM
Having multiple columns isn't unfair. I did it with the pure listbox control. Only having multiple values in one item was against the rules ;) Besides there is no speed gain whatsoever by having it in multiple columns. I used multiple columns mode because it looks much better that way imo. But as you can see, I got no bonus for making the app visually attractive and user friendly :(

Ex-FB
Oct 4th, 2004, 11:48 PM
Well the actual quote was (from Pino or Electroman I can't remember)

My first reaction was that the rules already said one per line and I then checked and saw it wasn't in. I then said well if it is allowed then it would loose points for appearance unless it was done very well with proper indenting or something like that. And as you can see after checking with others the change was made.

Which does imply more than one per line is to be frowned upon.

And adding columns makes a huge difference. Mine went from 15ms down to 10.5ms just by setting the column value from 0 to 4.

Ex-FB
Oct 4th, 2004, 11:54 PM
Well after testing all three (I've included your change and I've set mine to 4 colums) I get [compiled] averaging 5 indiviudal runs.

NoteMe: 11.02 ms
Ex-FB: 11.40 ms
Merri: 11.58 ms

So, it's pretty much down to random variances in speed. The speed difference with the columns might be explained by the fact that have a really poor graphics card on my main dev machine. I might run them on my games machine, but it's currently occupied (one of my daughters is playing Gauntlet :) )

Merri
Oct 5th, 2004, 12:33 AM
I still have a speed disadvantage when using a listbox, because I didn't optimize for it, so you shouldn't have anything to complain about :D

NoteMe
Oct 5th, 2004, 01:14 AM
Originally posted by Ex-FB
Well after testing all three (I've included your change and I've set mine to 4 colums) I get [compiled] averaging 5 indiviudal runs.

NoteMe: 11.02 ms
Ex-FB: 11.40 ms
Merri: 11.58 ms

So, it's pretty much down to random variances in speed. The speed difference with the columns might be explained by the fact that have a really poor graphics card on my main dev machine. I might run them on my games machine, but it's currently occupied (one of my daughters is playing Gauntlet :) )

Well it will be ZERO speed diffrence in the code if you have a X800 card or a Voodoo 5 card. Unless you have a FireGL card or something it will show up as a diffrence, and even then a small one. And I agree. The diffrences in out time is probably too small too pick a winner and a second and 3rd place from it.....

Merri
Oct 5th, 2004, 01:17 AM
Except if you concentrate on the algorithm speed only... see that nice post up there, my algo is 3.5 times faster than yours :D Guess I'll have to test Ex-FB's too.

NoteMe
Oct 5th, 2004, 01:29 AM
Yeah but that was not the contest...;)....I had an other algo that was much much faster, but I couldn't add more then just a few of the primes to the listbox in the first loop, so I had to add an other one afterwards, and then it got 0.1ms slower then the one I posted...that could possible have beaten you....but as I said...it was not the contest, the contest was with the listbox...;)

Merri
Oct 5th, 2004, 01:29 AM
And the current results:

Merri: 0.020394 ms
Ex-FB: 0.023467 ms
NoteMe: 0.071517 ms



Tested/testing code for Ex-FB:


Set Q = New sTime
Q.Init
Q.StartTime

lngLowPrimeCount = 0

For s = 3 To 9 Step 2
For t = s To 9 Step 2
bytNotPrime(s * t) = 1
Next t
Next s

For t = 3 To 90 Step 2
If bytNotPrime(t) = 0 Then
intLowPrimes(lngLowPrimeCount) = t
lngLowPrimeCount = lngLowPrimeCount + 1
End If
Next t

For s = 0 To lngLowPrimeCount - 1
lngNextPrime = intLowPrimes(s)
For t = lngNextPrime * lngNextPrime To 7919 Step (lngNextPrime + lngNextPrime)
bytNotPrime(t) = 1
Next t
Next s

Q.StopTime
MsgBox Format$(Q.RetTime * 1000, "0.000000") & " ms"



And as said, I'm doing this only for fun, just like you're doing with the listbox thingy. I could now update my code so that it would be a rocket with listbox stuff too, after taking a look on some of the code :)

If you want, you can compare with your faster code too! ;)


Edit Heh, noticed I had some listbox adding code in Ex-FB's sample, thus the timing is now faster. Close to mine :) Though, I'm still the only one with flexibility.

NoteMe
Oct 5th, 2004, 01:44 AM
Will do it when I get home....will be fun to see..

BodwadUK
Oct 5th, 2004, 03:32 AM
:lol: I wondered how on earth I had won

NoteMe
Oct 5th, 2004, 03:48 AM
We too, and now we wonder how Dave Sell won, and SeniorBadger came on second.....:D

BodwadUK
Oct 5th, 2004, 04:44 AM
I feel this is never going to rest :afrog:

Pino
Oct 5th, 2004, 04:47 AM
Originally posted by NoteMe
We too, and now we wonder how Dave Sell won, and SeniorBadger came on second.....:D

ok there was a mistake with bodwads code but the rest of the results are right i'm certain of that :) i've tested them twice now :)

BodwadUK
Oct 5th, 2004, 05:02 AM
Must be persecution I swear :lol:

Merri
Oct 5th, 2004, 06:14 AM
I still think Pino is doing it wrong... :D

Pino, you sure you don't see E+something in the end of Dave's and Senor's times? ;)

This is the clearest way to display the results, I guess:


MsgBox Format$(Q.RetTime * 1000, "0.000000") & " ms"


:)


Will we ever get a breakdown on why and how people got their points?

BodwadUK
Oct 5th, 2004, 06:23 AM
Now merri sit down

breath deeply

and relax..















Now you lost you loser loser loser loser

MOAHAHAHAHA :lol:

Merri
Oct 5th, 2004, 06:28 AM
Bodwad, I'm gonna take you to China soon.

So sit down.

Breath deeply.

Relax.












They're gonna eat you :D

NotLKH
Oct 5th, 2004, 06:36 AM
Originally posted by Pino
ok there was a mistake with bodwads code but the rest of the results are right i'm certain of that :) i've tested them twice now :)
Pino, I asked before.

I had submitted a dog of a code.
Slow, not meant to win, no optimization whatsoever.

THAT would have placed in the bottom 4 in speed.

I replaced it with some pretty good code.
You DID use the right code?


Now, this WAS a competition. Open, Friendly, Educational.
As such, there were no expectations of secrecy.
We can ALL see each others code.
We can ALL compile and run each others, compare theirs against ours, and form opinions as to who achieved the speed goal best.

And so we certainly expected an open evaluation, a public display, of our scores, not just a "What are they", but also "Why are they".

You've succeeded in giving us the "What".
Now, how about the "Why"?

:(

NotLKH
Oct 5th, 2004, 08:18 AM
Hmmm.
Again, Pino,

If you've not read all the posts, you might not have noticed.
In both your lists, Look at BodwardUK.


:wave:

mendhak
Oct 5th, 2004, 08:41 AM
We were allowed to resubmit code? :ehh: :ehh:

I really need to learn to pay attention.

Ex-FB
Oct 5th, 2004, 09:52 AM
Originally posted by Merri

They're gonna eat you :D

Mmmm. Hotdogs.

Ex-FB
Oct 5th, 2004, 09:54 AM
Originally posted by NoteMe
Well it will be ZERO speed diffrence in the code if you have a X800 card or a Voodoo 5 card. Unless you have a FireGL card or something it will show up as a diffrence, and even then a small one. And I agree. The diffrences in out time is probably too small too pick a winner and a second and 3rd place from it.....

Worse, I have a built in Intel graphics card with some funky sounding name which means it's about as fast as a drugged tortoise. But that's fine, I knew that when I bought it, it was only so i could play with Server 2003 (but now It's somehow ended up as my main dev machine.... don't ask me how :) )

NoteMe
Oct 5th, 2004, 11:41 AM
Originally posted by Pino
ok there was a mistake with bodwads code but the rest of the results are right i'm certain of that :) i've tested them twice now :)


I am pretty sure you where drunk while you where testing them....and that you are still drunk that can say something like that...look at the times....Dave Sells and SeniorBadgers code is about 30....I repeat 30 times as slow as my, Merri, and EX-FBs code....

StevenHickerson
Oct 5th, 2004, 01:35 PM
Well I tested the top scores down to mine just to bring in another opinion, and I think I can safely agree with the others, Dave Sell and SenorBadger seem way to slow to be winners.

Pinos Results:

StephenHickerson 63
Ex-FB 65
Dsheller 68
Merri 74
NoteMe 78
SeniorBadger 85
Dave Sell 92


My timing results

StevenHickerson .0293
Ex-FB .0346
Dsheller Untestable, missing function in zip that I downloaded.
Merri .0186
NoteMe .0137
SenorBadger .8021
DaveSell .4975


Now If I was judging Dsheller would be disqualified because of the missing function in his zip, but maybe something happened that I dont know about and he actually got his file to Pino appropriately.

Although my aglo is faster than Ex-FBs, I believe his presentation is better so I would agree with the scores given there.

Now dont want to hurt any feelings here but DaveSells.. his code, not that spectacular, actually feels a little overcoded for such a simple project. Uses multiple classes and such.. just seems to be a waste of system resources for the intended result. His time is slower than most others as well. Definately not enough 'sexy' code to make up for the almost half a second differnce in speed.

Then SenorBadger, his code is definately not sexy. No indentation in some areas, and no casing in function names to help distinguish them. And then he has the slowest out of the times I tested at nearly a full second to generate the primes.

Merri, code looks nice fast time, but slower than NoteMes. Also must mention here Merri went way beyond the requirments of the contest, but seeing the type of contest it is can't really give her any extra points for that. Sorry Merri but in fairness your only being given points on what was required.

NoteMe - fastest out of the tested code, code itself is average 'sexyness'. Merri's display is little better, and with such close times I would put NoteMe and Merri at a tie due to appearences.

So if I were judging out of the tested results I would put them in this order

NoteMe & Merri - 95 (Tie)
Ex-FB - 87
StevenHickerson - 85
DaveSell - 70
SenorBadger - 50
DSheller - Disqualified.

(Note this point system in no way relates to Pino's its one that I made myself with speed weighing heavily since it was the primary goal of the contest).


My Testing System:
P3 1.2 Ghz w/ 512Mb Ram
Non Compiled testing only
Code was run 5 times each and the average was taken as the time given.


Just my view on the situation, but like said before this was just a test contest and meant to be fun, I think in future contests the judging needs to be quicker and more accurate. It took what 2 weeks to get seemingly badly inaccurate scores. I dont want to get the judges up set with that statement, but its just my observation.

NoteMe
Oct 5th, 2004, 01:49 PM
Well Merri added more things to it, but it was two things that I would just comment on his project...don't take this the wrong way...it is positive critisism...something to grow on.

Names like:

Find old primes
and
Find new primes

is not good names on command buttons. What the hell does that mean....straighten things like that up. And the other thing was that he uses the deafault name on the command buttons so they are called Command1 and Command2...that is not sexy. Except that it was a great app.



ии

Merri
Oct 5th, 2004, 02:04 PM
Whoa, I posted even more the wrong one! I sent an older zip. I did remove the older button from the app. Oh well. Doesn't kill me. Anyways, for the return feedback: InitApp? Doesn't even allow to compile :D

Oh, btw, the captions were Find primes OLD and Find primes NEW... OLD for earlier version of the code and NEW for a speed improved one. Anyways, should've been more careful with the sent source.

NoteMe
Oct 5th, 2004, 02:16 PM
What....what have electroman done...:D...he deleted my post...and made a new one...that rascal.....

wossname
Oct 5th, 2004, 02:36 PM
I notice everyone is keeping VERY quiet about my score. Can't think why.





This is my 1000th non-chitchat post by the way, w00t!

Merri
Oct 5th, 2004, 02:40 PM
Because nobody is interested on...what was it called... .ORG or something ;)

NoteMe
Oct 5th, 2004, 05:35 PM
No one cares about .NET....I am pretty sure that if all the VB6 codes where transelated to .NET then all of them would beat you...:D

NotLKH
Oct 5th, 2004, 05:54 PM
Originally posted by NotLKH
Hmmm.
Again, Pino,

If you've not read all the posts, you might not have noticed.
In both your lists, Look at...

I see Pino hasn't popped in yet.

hmmm.

looks left, glances right, nope, no one looking...

BodwardUK

:wave:

Ex-FB
Oct 5th, 2004, 05:59 PM
Originally posted by wossname
I notice everyone is keeping VERY quiet about my score. Can't think why.



:p

Hard luck mate, I checked your code. 0.143 seconds!!! That's like 143 milliseconds, that's like 15 times slower than the mine, Merri's and NoteMe's code!!! :p

I put the start timer where you said in your code, but the bit for the end timer, that was all screwed up. Sorry mate, you have to stop the timer after the form has been shown.... nice try though!

Oh, P.S. I'm sorry to hear you live in Derby, I hope you recover soon ;)

NotLKH
Oct 5th, 2004, 06:08 PM
Originally posted by Ex-FB
:p

Hard luck mate, I checked your code. 0.143 seconds!!! That's like 143 milliseconds, that's like 15 times slower than the mine, Merri's and NoteMe's code!!! :p

I put the start timer where you said in your code, but the bit for the end timer, that was all screwed up. Sorry mate, you have to stop the timer after the form has been shown.... nice try though!

Oh, P.S. I'm sorry to hear you live in Derby, I hope you recover soon ;)
Ahh, but you see, he WON!

Good Job!

:)

NoteMe
Oct 5th, 2004, 07:16 PM
Yeah don't forget that he won....he won paralympics....but still he won...



now seriously....good job...:)

Electroman
Oct 5th, 2004, 08:32 PM
Yea Pino says he's gonna be off-l;ine for a couple of days. But by looking at the timing I can safely (almost) say that you can assume the top two will also change too. I don't think the presentations points were enough to bring them back from the times that I got when i tested it. Unfortunetly I don't have access to those so can't say 100% but I'm pretty sure ;).

Merri
Oct 6th, 2004, 02:37 AM
Now this wasn't a mess at all. It wasn't a failure either. It wasn't a something gone badly wrong.

It was a disaster called Pino the Flying Squirrel :D

NoteMe
Oct 6th, 2004, 04:28 AM
Hey hey hey....go easy on him.....it is an error everyone could have done. And it was a testing contest. Well he did an error, but he is at least man enough to look at it again, and it looks like he is man enough to change the results if they are wrong too.



Looking forward to see his results.
ии

Merri
Oct 6th, 2004, 06:04 AM
But one's gotta make most out of it now when he can to make sure it doesn't happen again?

Nah, I'm just evil ;) Don't care too much about me, Pino.

NotLKH
Oct 6th, 2004, 06:20 AM
Electro,
Think we can get a breakdown of these presentation points, along with the actual times, when all is said and done?

-Lou

Electroman
Oct 6th, 2004, 07:39 AM
Posted by NotLKH
Electro,
Think we can get a breakdown of these presentation points, along with the actual times, when all is said and done?

-Lou Don't think so, we had decided we'd just give the Overall scores, But I suppose we could give you the timings too once they have been redone though :).

Ex-FB
Oct 6th, 2004, 08:25 AM
Either way, it was fun!

And it did do it's job as a test and helped iron out a few wrinkles.

I suspect maybe the only confusion with the timings arose from people doing their calcs in the form load event and ending the timer before the form is shown, so all in all it's a pretty easy mistake to make. It also showed us the problems with having a solution in the millisecond range - nigh-on impossible to measure.

NotLKH
Oct 8th, 2004, 01:59 PM
When you post the fixed results,
Please Don't forget about also fixing

BodwaRdUK

as in:



Mark Name
__________________
VbasicGirl 33
Acidic 37
BPD 38
NotLKH 39
Cyborg 39
Riis 46
RobDog 55
BodwardUK 59
StephenHickerson 63
Ex-FB 65
Dsheller 68
Merri 74
NoteMe 78
SeniorBadger 85
Dave Sell 92 <<< winner
__________________


:wave:

NoteMe
Oct 8th, 2004, 03:18 PM
Ohhh...and don't forget to put


SeniorBadger
Dave Sell

at the end of the list....:D

Merri
Oct 9th, 2004, 12:03 AM
Btw, did you notice StephenHickerson on the list? Who the hell he is?

Atleast I'm not Merry on the list, even though it would be just as correct as I use both nicks :)

StevenHickerson
Oct 9th, 2004, 02:45 AM
thats some imposter I heard he got a time of like 5 seconds before they clicked cancel and at that time he only had the first 100 primes... tsk tsk :)

EricDalnas
Oct 26th, 2004, 10:33 AM
Wasn't I supposed to get postcounts for being a last place finisher?!