Re: Coverage Calculation Speed in VBA, VB, C# and C++



fairbros@xxxxxxxxxxx wrote:
Nigel

The usual mistake I've come across even with programmers who should
know better is to declare an array that has say, 13,983,616 elements
as long when if the values it holds is less than 256 then byte or
short is OK.

I have noticed Excel users declaring double variables for no good
reason when only integers are involved. I put it down to force of
habit dealing with cents or pennies. If it has not much effect on the
timing of the routine then it doesn't really matter.

With Michael' s code I will add an array or vector to flag the blocks
as covered or not which takes up a bit of memory, when I do the
timings for the other languages and there are a couple of minor
optimizations I will include which reduce the time for calculating
lower blocks. Definitely, we must now measure in micro seconds maybe
even nano.

I was in a state of shock when I made the last post so I read the
wrong figure - instead of 2.6 secs it should have been 6.52 sec down
from 31 mins for VBA. Let me just spell that out - FROM 1860 secs TO
6.52 secs or 285 times better in Excel or Access. I confidently
predict that the crown for King of Coverage Speed Calculation will
pass from John Rawson, Esquire to Michael Harrington, a fellow
Australian, photons or no photons.

Give over :-)

CM checks the single 44,45,46,47,48,49 in a fraction of a second (about 0.2 seconds here). And that's using code to check any number of tickets. With respect to Michael, the code he's given only checks one line, which is what you asked for.

Modify it to check any wheel and see what you think of the speed. Then you can modify your prediction :-)

John
.



Relevant Pages

  • Re: Declaring an array of List Generic Class elements
    ... Eitan wrote: ... I would like to declare an array of this myList. ... How would I modify the declaration of myList so it will represents an ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Array question
    ... > All that does is declare the array. ... Prev by Date: ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Passing an array of structuresfrom a pointer?
    ... to only declare structs in headers and then define the ... the struct should be declared ... what if you have a simple array like this: ... In the header we would declare? ...
    (microsoft.public.vc.language)
  • Re: vb.net class
    ... about fixed array lenghts or using ReDim statements. ... code ensures everything in the array is a String because you declare it ... Count can be generated from the time list, not need to store ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Scope of Variant / Array
    ... Even though you declared the array "public" in the main (parent) form, ... a form code module is the same as a class module. ... Constants, fixed-length strings, arrays, user-defined types and Declare ...
    (microsoft.public.access.formscoding)