by Webbi » Thu, 25 Jun 2009 04:43:46
n Tue, 23 Jun 2009 14:08:38 -0500, dpb < XXXX@XXXXX.COM > wrote:
<snipperoni - a San Francisco treat>
Understood.
Agreed. I've narrowed down where my speed issues are to a routine that
contains both Recordset creation and extensive calculations within a
loop. So I had two sections within this one routine that were slowing
things down a lot.
I tacked first the Recordset issue first. Rather than create a
recordset that contained all the information the routine would need
for any situation, I change the SQL to deliver only the bare
essentials based on what the routine needed "at that time" only. This
saved significant time. Then I replaced some of the recordset
manipulation code to use an array instead (using .GetRows) that also
shaved off considerable waste.
Now I'm down to a loop that has to perform extensive date manipulation
mathematics, which brings me to the Weekday count component we're
currently dealing with.
So yes, your suggestion is indeed well taken.
This is a valuable lesson. While I do like as least amount of lines in
my code as possible for clarity, I certainly don't want a bunch of
cryptic lines for the same reason, especially if there are no speed
gains.
Certainly makes sense. Unfortunately I cannot think up a different way
to perform the algorithm in question. This has left me to deal with
the alternate instruction approach, which has shown some improvement
over my bloated approach.
My inability to find an alternate approach to solving my particular
task aside, I understand what you are saying as being most important.
This sounds interesting (and simple, though at this moment of replying
don't have it worked out).
I take my WholeWeeks and mulitply this by 2 to get weekend days.
Subtract this from my TotalDays.
Then I must make an adjustment based on what day of week the count
started and ended.
I've got to give this some thought, but it would seem to remove the
need for a loop. Thx. :-)
Is there a specific website that you refer to as "VB Books Online"?
I was thinking about this as well, actually. When I noted the
"Variant" type, I was trying to remember why it was there. But then,
this is my old code and has been produced over the years as I was
learning one small thing after another.
Thank you VERY MUCH for taking the time to write your lesson.
Regards,
Webbiz