Re: Ordinal Versus Columnname by William
William
Fri Jul 11 14:58:03 CDT 2003
Sorry, enumerations are an order of magnitude faster than string-based
object references.
--
____________________________________
Bill Vaughn
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
"Kathleen Dollard" <kathleen@mvps.org> wrote in message
news:%232CtBz8RDHA.1324@TK2MSFTNGP11.phx.gbl...
> Bill,
>
> Could you clarify this?
>
> > However, my tests show that strongly typed DataSets are
> > slightly faster than enumerations, but not enough to make me use STDs
> > everywhere. Enumerations (in my tests) are an order of magnitude faster
> > (2000 vs 200 ticks).
>
> What is the second relative to?
>
> Kathleen
>
>
> "William (Bill) Vaughn" <billvaRemoveThis@nwlink.com> wrote in message
> news:er1vFZ0RDHA.1552@TK2MSFTNGP10.phx.gbl...
> > I'm with Steve. However, my tests show that strongly typed DataSets are
> > slightly faster than enumerations, but not enough to make me use STDs
> > everywhere. Enumerations (in my tests) are an order of magnitude faster
> > (2000 vs 200 ticks). How much you benefit from this really depends on
how
> > often the references are made. While it might save 10% of the time to
> > execute a function, the function might play a .1% role in the overall
> > performance of the application.
> >
> > --
> > ____________________________________
> > Bill Vaughn
> > www.betav.com
> > Please reply only to the newsgroup so that others can benefit.
> > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> > __________________________________
> >
> > "Steve Drake" <Steve@_NOSPAM_Drakey.co.uk> wrote in message
> > news:uenC4xtRDHA.2240@TK2MSFTNGP11.phx.gbl...
> > > If you need speed and readability, you can use ENUM eg:
> > >
> > > enum tablename
> > > {
> > > ID,
> > > Name,
> > > Other
> > > };
> > >
> > > and your code could read :
> > >
> > > YourDataSetOrWhatEver.Tables[0].Rows[0][tablename.ID]
> > > YourDataSetOrWhatEver.Tables[0].Rows[0][tablename.Name]
> > >
> > > Cheers
> > >
> > > Steve
> > >
> > > "Per Hornshøj-Schierbeck" <hojou@hotmaill.com> wrote in message
> > > news:e8BE%23OtRDHA.1552@TK2MSFTNGP10.phx.gbl...
> > > > I think most books on ADO.NET tells you why. It has to do with using
> the
> > > > field name requires the object to loop through the columns checking
> > their
> > > > names before deciding which index it is. Using the name instead of
the
> > > > ordinal value makes your code easier to read, but if you require
speed
> > in
> > > a
> > > > long loop use the ordinal value.
> > > >
> > > > I used the DevPartner Studio from Compuware to measure performance
so
> i
> > > know
> > > > for a fact, that in a test environment i ran with two different
> > methods -
> > > > one with ordinal values, the other with string value - the ordinal
> call
> > > was
> > > > between 8 and 10 times faster. Both are pretty quick and if all you
> need
> > > is
> > > > read a few values (not inside a loop) i'd probably still use the
> string
> > > > value so it would be easier to read later (or edit/change the sql),
> but
> > if
> > > > you're looping through 1000 records trying to match something, then
go
> > for
> > > > the ordinal values.
> > > >
> > > > Per
> > > >
> > > >
> > > > "Keith N" <knicholson@ksdynamics.com> wrote in message
> > > > news:OlZoTBtRDHA.1552@TK2MSFTNGP10.phx.gbl...
> > > > > I need some references to some hard facts to why the Ordinal value
> is
> > a
> > > > > better choice than the column/field name when extracting
information
> > of
> > > a
> > > > > row in ADO.NET.
> > > > >
> > > > > Anybody have some good reference with numbers that I can show to
> > > someone.
> > > > >
> > > > > Peace,
> > > > > Keith
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>