Guess the Mods missed declaring that one. Oh well. Next time.
Still did better than I thought I would.
Later.
Printable View
Guess the Mods missed declaring that one. Oh well. Next time.
Still did better than I thought I would.
Later.
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
EX_FB:
.1128 Secoinds, compiled.
Alrighty then.
Hey, Ex, Note, Bodwad,
Whats My Time???
http://www.vbforums.com/attachment.p...postid=1797398
Hey, Jala,
Just making sure, JIC Ex_VB is correct.
This IS my code you tested, isn't it???
[Highlight=VB]
'on your "start"
call BUILD_THEM
'and then, on a bas:
VB Code:
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
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:
ADded you NotLKH to my times...Quote:
Originally posted by NoteMe
IDE:
Code:Bodwad: 0.21177 sec
NotLKH: 0.01567 sec
Ex-FB: 0.00580 sec
NoteMe: 0.00567 sec
Compiled:
Code:Bodwad: 0.0530 sec
NotLKH: 0.00571 sec
Ex-FB: 0.00485 sec
NoteMe: 0.00417 sec
Can't understand how that dog won with 10-40 times slower code then us...:D....where are your resubmitted code....
:rolleyes:
Think this is it. its the one on my desktop :afrog:
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.
I will test both your codes when I get home. I am atschool now...
The judges decision is final and cannot be changed. (I Hope :afrog: )
Well lets wait and see....looks like Pino is in exile....;)
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.
It might have been code layout and complexity. Use of prefab functions might reduce score etc. Dont know really. :)
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!
:)
http://www.vbforums.com/attachment.p...postid=1797398Quote:
Originally posted by BodwadUK
...Use of prefab functions...
Such As, IYHO?
:)
Such as format, Sin, Cos, replace, split
etc etc
I dont know if anyone used them I am just saying its possible :)
Is this an accurate assesment of the assumptions made in our codes:
:wave:VB Code:
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?[sup]*[/sup], does not assume end boundary. +0
* You decide: Call is made to test 2 thru the following:
VB Code:
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
Quote:
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...;)
Update:
Quote:
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:
Code: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:
Code: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
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
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
Hey stop complaining I won :afrog:
Did you use the same timing module noteme? :afrog:
99/100 read it and weep.
Quote:
Originally posted by BodwadUK
Did you use the same timing module noteme? :afrog:
Off course I did.....look who posted it.....;)
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:.
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 :).Quote:
Posted by NotLKH
Then do the times of those that Noteme list seem to accurately correspond with the actual testing results?
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!
again i am sorry for the mix upCode:
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
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?
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
Bhahhhaa...I am number 3 now..::D
Intresting update....thanks to NotLKH for noticing...;)
Now Dave Sell is on the test bench...;)
'Quote:
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:
Code: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:
Code: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
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...;)
Quote:
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:
Code: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:
Code: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
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...
Still Bodward?
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.
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):
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.Code:Merri: 0.020394 ms
NoteMe: 0.071517 ms
Tested/testing code for Merri (this is the slightly fixed version):
VB Code:
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:
VB Code:
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
:p Yeah, sorry I didn't mean to sound serious, just didn't want the competitions to stop becuase of all the complications.Quote:
Originally posted by Merri
Ex-FB: if you didn't notice, we're doing all this stuff at the moment for fun :D
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: