[thelist] RecordCount

Warden, Matt mwarden at mattwarden.com
Thu Mar 21 13:06:00 CST 2002


On Mar 21, Chris Blessing had something to say about RE: [thelist] RecordCount

>re: code-wise
>I couldn't agree more; it's especially cool when you associate the indexes
>with relevant names for the various "fields" in the array (like you would
>use with rs() objects).

exactly

>About that performance hit... it's mostly negligible since returning less
>than 250 records isn't all that taxing on the server to begin with, correct?
>Or is this mostly a hardware issue (i.e. more = better)?

well, im sure hardware affects the performance, but that's not really what
i'm talking about.

you've got a resultset and you then call a method to turn that resultset
into a two-dim array. that's gotta take time, eh? i don't have exact
numbers (the article was on asptoday, which is subscriber-only -- has been
for a good while -- bastards), but i can try to give a better picture.

lets say the getrows method takes x seconds (let's say .5 s) to convert
the recorset to a two-dim array.

lets say the resultset is such a size that it takes y seconds to return

and let's say you save .1 seconds per 50 rows by looping throgh with
arrays rather than the recordset object.

ah, screw it, here's a table:


rows   getrows()   retrieval     array loop save   time diff over RS obj
---------------------------------------------------------------------
 50     .5 s         .2 s             -.1                  +.4 s
100     .5 s         .3 s             -.2                  +.3 s
200     .5 s         .3 s             -.4                  +.1 s
250     .5 s         .3 s             -.5                  +.0 s
300     .5 s         .4 s             -.6                  -.1 s

ok, now, that just happened to work out. i don't know that it's .1 for
every 50 records, but you get the idea, eh?

retrieval is constant no matter what the method to loop through the result
set.

the hit on getrows is constant (for the most part) no matter the resultset
size.

so, the fewer your resultset, the greater percentage the getrows hit of
your total retrieval & display time. in my examples, the getrows his is
always greater than the retrieval time. i dunno if that's the case, but
you can see how it becomes less of an issue as retrieval time gets larger.

if you're a math type, you have a ratio of the getrows hit over the
retrieval time. the getrows hit is constant (for the most part) and the
retrieval time is variable. as the retrieval time increases, the ratio
will near 0

	getrows hit
	-----------
	retrieval

in my example, you have the following ratios:

.5  .5  .5  .5  .5
--  --  --  --  --
.2  .3  .3  .3  .4

as you can see, it gets closer and closer to zero as the getrows his
becomes less and less relative to the retrieval time.

ok, i hope i made sense. usually when my posts are this long, its because
i keep thinking i'm not clear...

that help?

--
mattwarden
mattwarden.com




More information about the thelist mailing list