Multimobile Development: Building Applications for any Smartphone
DataGrid vs. XML Performance
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngspeed' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Rangi Keen
I wanted to know what the performance difference was in using the DataGrid
control and an <asp:xml> element to display a table of data. To this end, I
set up both to use the same XML file as the data source and displayed the
page with no formatting. The DataGrid was an order of magnitude slower than
the XML/XSL transformation equivalent. I wouldn't have expected there to be
so much difference.

Does anyone have any suggestions on how to make the DataGrid faster (if
possible), or insights into why there would be such a large performance
difference?

Thanks,
Rangi Keen
Framework Technologies
http://www.frametech.com/ <http://www.frametech.com/>

...........................................................................
Necessity is the plea for every infringement of human freedom.
It is the argument of tyrants; it is the creed of slaves.
-William Pitt, British prime-minister (1759-1806)

Reply to this message...
Vote that this is a GOOD answer...
 
Really good experience at the Apple Store
MonoDroid – looking *awesome*
 
    
ToddC@match.com
Can you post the code?

tc

-----Original Message-----
From: Rangi Keen [mailto:Click here to reveal e-mail address]
Sent: Thursday, May 30, 2002 7:33 AM
To: aspngspeed
Subject: [aspngspeed] DataGrid vs. XML Performance

I wanted to know what the performance difference was in using the DataGrid
control and an <asp:xml> element to display a table of data. To this end, I
set up both to use the same XML file as the data source and displayed the
page with no formatting. The DataGrid was an order of magnitude slower than
the XML/XSL transformation equivalent. I wouldn't have expected there to be
so much difference.

Does anyone have any suggestions on how to make the DataGrid faster (if
possible), or insights into why there would be such a large performance
difference?

Thanks,
Rangi Keen
Framework Technologies
http://www.frametech.com/ <http://www.frametech.com/>

...........................................................................
Necessity is the plea for every infringement of human freedom.
It is the argument of tyrants; it is the creed of slaves.
-William Pitt, British prime-minister (1759-1806)

| [aspngspeed] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngspeed.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives
Reply to this message...
Vote that this is a GOOD answer...
 
First volume of Multimobile Development nearly ready to go to press
A mention on Developing for the iPhone and Android: The pros and cons
 
    
Rangi Keen
I have two files: DataGrid.aspx and XML.aspx, both with code behind pages in
C#. The aspx pages simply have placeholder controls (<asp:datagrid
id="DataGrid1" runat="server"/> and <asp:xml id="Xml1" runat="server"/>).
Here's the contents of the Page_Load method for DataGrid.aspx.cs:

DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("1000InfoItems.xml"));

DataView dv = new DataView(ds.Tables["InfoItem"]);
DataGrid1.DataSource = dv;

DataGrid1.DataBind();

And here's the contents of the Page_Load method for Xml.aspx.cs:

Xml1.DocumentSource = "1000InfoItems.xml";
Xml1.TransformSource = "InfoItems.xsl";

InfoItems.xsl contains a simple XSL template to display a HTML table with
the same number of columns in the same order as the DataGrid creates.

I have tried using XML with both 100 and 1000 items and the timing from the
trace (from page init to page unload) is as follows:

100 Items: DataGrid - 0.19 seconds, XML - 0.02 seconds
1000 Items: DataGrid - 1.8 seconds, XML - 0.15 seconds
...........................................................................
Necessity is the plea for every infringement of human freedom.
It is the argument of tyrants; it is the creed of slaves.
-William Pitt, British prime-minister (1759-1806)

-----Original Message-----
From:     Marcie Jones [mailto:Click here to reveal e-mail address]
Sent:    Thursday, 30 May, 2002 9:43 AM
To:    aspngDataGridRepeaterDatalist
Subject:    [aspngdatagridrepeaterdatalist] Re: DataGrid vs. XML
Performance

That sounds like an interesting experiment! Can you
share your results (exact times) with the list, and
maybe the source code for your two options?

Marcie

--- Rangi Keen <Click here to reveal e-mail address> wrote:
[Original message clipped]

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

| [aspngdatagridrepeaterdatalist] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngdatagridrepeaterdatalist.asp =
JOIN/QUIT

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Dennis West
The datagrid is a server control that give you much more functionality than
a display you should use a repeater if you want to compare to a xml
display..

----- Original Message -----
From: "Rangi Keen" <Click here to reveal e-mail address>
To: "aspngspeed" <Click here to reveal e-mail address>
Sent: Thursday, May 30, 2002 5:33 AM
Subject: [aspngspeed] DataGrid vs. XML Performance

[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
First chapters of Multimobile Development book now available on Apress Alpha program
iPad
 
    
ToddC@match.com
I am willing to bet that populating the DataSet is what is taking so long.
Those things are real pigs when it comes to read only work in ASP.

Your problem it not the DataGrid, but the DataSet.

I am not real sharp on XML, so I am not sure about the fastest way to get
XML Doc elements into a collection that can be bound to a DataGrid.

tc

-----Original Message-----
From: Rangi Keen [mailto:Click here to reveal e-mail address]
Sent: Thursday, May 30, 2002 9:47 AM
To: aspngspeed
Subject: [aspngspeed] Re: DataGrid vs. XML Performance

I have two files: DataGrid.aspx and XML.aspx, both with code behind pages in
C#. The aspx pages simply have placeholder controls (<asp:datagrid
id="DataGrid1" runat="server"/> and <asp:xml id="Xml1" runat="server"/>).
Here's the contents of the Page_Load method for DataGrid.aspx.cs:

DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("1000InfoItems.xml"));

DataView dv = new DataView(ds.Tables["InfoItem"]);
DataGrid1.DataSource = dv;

DataGrid1.DataBind();

And here's the contents of the Page_Load method for Xml.aspx.cs:

Xml1.DocumentSource = "1000InfoItems.xml";
Xml1.TransformSource = "InfoItems.xsl";

InfoItems.xsl contains a simple XSL template to display a HTML table with
the same number of columns in the same order as the DataGrid creates.

I have tried using XML with both 100 and 1000 items and the timing from the
trace (from page init to page unload) is as follows:

100 Items: DataGrid - 0.19 seconds, XML - 0.02 seconds
1000 Items: DataGrid - 1.8 seconds, XML - 0.15 seconds
...........................................................................
Necessity is the plea for every infringement of human freedom.
It is the argument of tyrants; it is the creed of slaves.
-William Pitt, British prime-minister (1759-1806)

-----Original Message-----
From:     Marcie Jones [mailto:Click here to reveal e-mail address]
Sent:    Thursday, 30 May, 2002 9:43 AM
To:    aspngDataGridRepeaterDatalist
Subject:    [aspngdatagridrepeaterdatalist] Re: DataGrid vs. XML
Performance

That sounds like an interesting experiment! Can you
share your results (exact times) with the list, and
maybe the source code for your two options?

Marcie

--- Rangi Keen <Click here to reveal e-mail address> wrote:
[Original message clipped]

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

| [aspngdatagridrepeaterdatalist] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngdatagridrepeaterdatalist.asp JOIN/QUIT

| [aspngspeed] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngspeed.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives
Reply to this message...
Vote that this is a GOOD answer...
 
New book project – Multimobile Development: Building Applications for any Smartphone
Dive into HTML5
 
    
Rangi Keen
Actually, the majority of the time is not spent in the Page_Load call (where
the DataSet is populated), but rather between PreRender and SaveViewState
and during Render. Less than 25% of the total time is spent loading the XML
into the DataSet.

...........................................................................
Necessity is the plea for every infringement of human freedom.
It is the argument of tyrants; it is the creed of slaves.
-William Pitt, British prime-minister (1759-1806)

-----Original Message-----
From: Click here to reveal e-mail address [mailto:Click here to reveal e-mail address]
Sent: Thursday, 30 May, 2002 11:00 AM
To: aspngspeed
Subject: [aspngspeed] Re: DataGrid vs. XML Performance

I am willing to bet that populating the DataSet is what is taking so long.
Those things are real pigs when it comes to read only work in ASP.
Your problem it not the DataGrid, but the DataSet.
I am not real sharp on XML, so I am not sure about the fastest way to get
XML Doc elements into a collection that can be bound to a DataGrid.
tc

-----Original Message-----
From: Rangi Keen [ mailto:Click here to reveal e-mail address <mailto:Click here to reveal e-mail address> ]

Sent: Thursday, May 30, 2002 9:47 AM
To: aspngspeed
Subject: [aspngspeed] Re: DataGrid vs. XML Performance
I have two files: DataGrid.aspx and XML.aspx, both with code behind pages in

C#. The aspx pages simply have placeholder controls (<asp:datagrid
id="DataGrid1" runat="server"/> and <asp:xml id="Xml1" runat="server"/>).
Here's the contents of the Page_Load method for DataGrid.aspx.cs:
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("1000InfoItems.xml"));
DataView dv = new DataView(ds.Tables["InfoItem"]);
DataGrid1.DataSource = dv;
DataGrid1.DataBind();
And here's the contents of the Page_Load method for Xml.aspx.cs:
Xml1.DocumentSource = "1000InfoItems.xml";
Xml1.TransformSource = "InfoItems.xsl";
InfoItems.xsl contains a simple XSL template to display a HTML table with
the same number of columns in the same order as the DataGrid creates.
I have tried using XML with both 100 and 1000 items and the timing from the
trace (from page init to page unload) is as follows:
100 Items: DataGrid - 0.19 seconds, XML - 0.02 seconds
1000 Items: DataGrid - 1.8 seconds, XML - 0.15 seconds
...........................................................................
Necessity is the plea for every infringement of human freedom.
It is the argument of tyrants; it is the creed of slaves.
-William Pitt, British prime-minister (1759-1806)
-----Original Message-----
From: Marcie Jones [ mailto:Click here to reveal e-mail address
<mailto:Click here to reveal e-mail address> ]
Sent: Thursday, 30 May, 2002 9:43 AM
To: aspngDataGridRepeaterDatalist
Subject: [aspngdatagridrepeaterdatalist] Re: DataGrid vs. XML
Performance
That sounds like an interesting experiment! Can you
share your results (exact times) with the list, and
maybe the source code for your two options?
Marcie
--- Rangi Keen <Click here to reveal e-mail address> wrote:
[Original message clipped]

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com <http://fifaworldcup.yahoo.com>
| [aspngdatagridrepeaterdatalist] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngdatagridrepeaterdatalist.asp
<http://www.aspfriends.com/aspfriends/aspngdatagridrepeaterdatalist.asp> =
JOIN/QUIT
| [aspngspeed] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngspeed.asp
<http://www.asplists.com/asplists/aspngspeed.asp> = JOIN/QUIT
| http://www.asplists.com/search <http://www.asplists.com/search> = SEARCH
Archives
| [aspngspeed] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngspeed.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives
Reply to this message...
Vote that this is a GOOD answer...
 
 
    
ToddC@match.com
Have you tried turning off viewstate to see if that helps? =
Serialization
again...

Tc

-----Original Message-----
From: Rangi Keen [mailto:Click here to reveal e-mail address]=20
Sent: Thursday, May 30, 2002 10:32 AM
To: aspngspeed
Subject: [aspngspeed] Re: DataGrid vs. XML Performance

Actually, the majority of the time is not spent in the Page_Load call =
(where
the DataSet is populated), but rather between PreRender and =
SaveViewState
and during Render. Less than 25% of the total time is spent loading the =
XML
into the DataSet.

.......................................................................=
....
Necessity is the plea for every infringement of human freedom.
It is the argument of tyrants; it is the creed of slaves.
-William Pitt, British prime-minister (1759-1806)

-----Original Message-----
From: Click here to reveal e-mail address [mailto:Click here to reveal e-mail address]
Sent: Thursday, 30 May, 2002 11:00 AM
To: aspngspeed
Subject: [aspngspeed] Re: DataGrid vs. XML Performance

I am willing to bet that populating the DataSet is what is taking so =
long.=A0
Those things are real pigs when it comes to read only work in ASP.
Your problem it not the DataGrid, but the DataSet.=20
I am not real sharp on XML, so I am not sure about the fastest way to =
get
XML Doc elements into a collection that can be bound to a DataGrid.
tc=20

-----Original Message-----=20
From: Rangi Keen [mailto:Click here to reveal e-mail address]=20
Sent: Thursday, May 30, 2002 9:47 AM=20
To: aspngspeed=20
Subject: [aspngspeed] Re: DataGrid vs. XML Performance=20
I have two files: DataGrid.aspx and XML.aspx, both with code behind =
pages in

C#. The aspx pages simply have placeholder controls (<asp:datagrid=20
id=3D"DataGrid1" runat=3D"server"/> and <asp:xml id=3D"Xml1" =
runat=3D"server"/>).=20
Here's the contents of the Page_Load method for DataGrid.aspx.cs:=20
DataSet ds =3D new DataSet();=20
ds.ReadXml(Server.MapPath("1000InfoItems.xml"));=20
DataView dv =3D new DataView(ds.Tables["InfoItem"]);=20
DataGrid1.DataSource =3D dv;=20
DataGrid1.DataBind();=20
And here's the contents of the Page_Load method for Xml.aspx.cs:=20
Xml1.DocumentSource =3D "1000InfoItems.xml";=20
Xml1.TransformSource =3D "InfoItems.xsl";=20
InfoItems.xsl contains a simple XSL template to display a HTML table =
with=20
the same number of columns in the same order as the DataGrid creates.=20
I have tried using XML with both 100 and 1000 items and the timing from =
the=20
trace (from page init to page unload) is as follows:=20
100 Items: DataGrid - 0.19 seconds, XML - 0.02 seconds=20
1000 Items: DataGrid - 1.8 seconds, XML - 0.15 seconds=20
.......................................................................=
....=20
Necessity is the plea for every infringement of human freedom.=20
It is the argument of tyrants; it is the creed of slaves.=20
-William Pitt, British prime-minister (1759-1806)=20
=A0-----Original Message-----=20
From: =A0 Marcie Jones [mailto:Click here to reveal e-mail address]=20
Sent:=A0=A0 Thursday, 30 May, 2002 9:43 AM=20
To:=A0=A0=A0=A0 aspngDataGridRepeaterDatalist=20
Subject:=A0=A0=A0=A0=A0=A0=A0 [aspngdatagridrepeaterdatalist] Re: =
DataGrid vs. XML=20
Performance=20
That sounds like an interesting experiment!=A0 Can you=20
share your results (exact times) with the list, and=20
maybe the source code for your two options?=20
Marcie=20
--- Rangi Keen <Click here to reveal e-mail address> wrote:=20
[Original message clipped]

__________________________________________________=20
Do You Yahoo!?=20
Yahoo! - Official partner of 2002 FIFA World Cup=20
http://fifaworldcup.yahoo.com=20
| [aspngdatagridrepeaterdatalist] member Click here to reveal e-mail address =3D YOUR =
ID=20
| =
http://www.aspfriends.com/aspfriends/aspngdatagridrepeaterdatalist.asp =
=3D=20
JOIN/QUIT=20
| [aspngspeed] member Click here to reveal e-mail address =3D YOUR ID=20
| http://www.asplists.com/asplists/aspngspeed.asp =3D JOIN/QUIT=20
| http://www.asplists.com/search =3D SEARCH Archives=20
| [aspngspeed] member Click here to reveal e-mail address =3D YOUR ID
| http://www.asplists.com/asplists/aspngspeed.asp =3D JOIN/QUIT
| http://www.asplists.com/search =3D SEARCH Archives
| [aspngspeed] member Click here to reveal e-mail address =3D YOUR ID
| http://www.asplists.com/asplists/aspngspeed.asp =3D JOIN/QUIT
| http://www.asplists.com/search =3D SEARCH Archives

Reply to this message...
Vote that this is a GOOD answer...
 
Steve Jobs’ thoughtful/thought provoking Thoughts on Flash…
Handy list of countries in CSV format
 
    
ToddC@match.com
The more I think about this...

25% of the total time is pretty significant.

You could also try creating the HTML table manually, but I really think that
if the Data is in XML, the transform _should_be_ faster.

tc

-----Original Message-----
From: Click here to reveal e-mail address [mailto:Click here to reveal e-mail address]
Sent: Thursday, May 30, 2002 11:04 AM
To: aspngspeed
Subject: [aspngspeed] Re: DataGrid vs. XML Performance

Have you tried turning off viewstate to see if that helps? Serialization
again...

Tc

-----Original Message-----
From: Rangi Keen [mailto:Click here to reveal e-mail address]
Sent: Thursday, May 30, 2002 10:32 AM
To: aspngspeed
Subject: [aspngspeed] Re: DataGrid vs. XML Performance

Actually, the majority of the time is not spent in the Page_Load call (where
the DataSet is populated), but rather between PreRender and SaveViewState
and during Render. Less than 25% of the total time is spent loading the XML
into the DataSet.

...........................................................................
Necessity is the plea for every infringement of human freedom.
It is the argument of tyrants; it is the creed of slaves.
-William Pitt, British prime-minister (1759-1806)

-----Original Message-----
From: Click here to reveal e-mail address [mailto:Click here to reveal e-mail address]
Sent: Thursday, 30 May, 2002 11:00 AM
To: aspngspeed
Subject: [aspngspeed] Re: DataGrid vs. XML Performance

I am willing to bet that populating the DataSet is what is taking so long. 
Those things are real pigs when it comes to read only work in ASP.
Your problem it not the DataGrid, but the DataSet.
I am not real sharp on XML, so I am not sure about the fastest way to get
XML Doc elements into a collection that can be bound to a DataGrid.
tc

-----Original Message-----
From: Rangi Keen [mailto:Click here to reveal e-mail address]
Sent: Thursday, May 30, 2002 9:47 AM
To: aspngspeed
Subject: [aspngspeed] Re: DataGrid vs. XML Performance
I have two files: DataGrid.aspx and XML.aspx, both with code behind pages in

C#. The aspx pages simply have placeholder controls (<asp:datagrid
id="DataGrid1" runat="server"/> and <asp:xml id="Xml1" runat="server"/>).
Here's the contents of the Page_Load method for DataGrid.aspx.cs:
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("1000InfoItems.xml"));
DataView dv = new DataView(ds.Tables["InfoItem"]);
DataGrid1.DataSource = dv;
DataGrid1.DataBind();
And here's the contents of the Page_Load method for Xml.aspx.cs:
Xml1.DocumentSource = "1000InfoItems.xml";
Xml1.TransformSource = "InfoItems.xsl";
InfoItems.xsl contains a simple XSL template to display a HTML table with
the same number of columns in the same order as the DataGrid creates.
I have tried using XML with both 100 and 1000 items and the timing from the
trace (from page init to page unload) is as follows:
100 Items: DataGrid - 0.19 seconds, XML - 0.02 seconds
1000 Items: DataGrid - 1.8 seconds, XML - 0.15 seconds
...........................................................................
Necessity is the plea for every infringement of human freedom.
It is the argument of tyrants; it is the creed of slaves.
-William Pitt, British prime-minister (1759-1806)
 -----Original Message-----
From:   Marcie Jones [mailto:Click here to reveal e-mail address]
Sent:   Thursday, 30 May, 2002 9:43 AM
To:     aspngDataGridRepeaterDatalist
Subject:        [aspngdatagridrepeaterdatalist] Re: DataGrid vs. XML
Performance
That sounds like an interesting experiment!  Can you
share your results (exact times) with the list, and
maybe the source code for your two options?
Marcie
--- Rangi Keen <Click here to reveal e-mail address> wrote:
[Original message clipped]

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
| [aspngdatagridrepeaterdatalist] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngdatagridrepeaterdatalist.asp =
JOIN/QUIT
| [aspngspeed] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngspeed.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives
| [aspngspeed] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngspeed.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives
| [aspngspeed] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngspeed.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

| [aspngspeed] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngspeed.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives
Reply to this message...
Vote that this is a GOOD answer...
 
Really good experience at the Apple Store
MonoDroid – looking *awesome*
 
    
Rangi Keen
I tried that already and it makes very little difference in the timing.

...........................................................................
Necessity is the plea for every infringement of human freedom.
It is the argument of tyrants; it is the creed of slaves.
-William Pitt, British prime-minister (1759-1806)

-----Original Message-----
From:     Click here to reveal e-mail address [mailto:Click here to reveal e-mail address]
Sent:    Thursday, 30 May, 2002 12:04 PM
To:    aspngspeed
Subject:    [aspngspeed] Re: DataGrid vs. XML Performance

Have you tried turning off viewstate to see if that helps? Serialization
again...

Tc

-----Original Message-----
From: Rangi Keen [mailto:Click here to reveal e-mail address]
Sent: Thursday, May 30, 2002 10:32 AM
To: aspngspeed
Subject: [aspngspeed] Re: DataGrid vs. XML Performance

Actually, the majority of the time is not spent in the Page_Load call (where
the DataSet is populated), but rather between PreRender and SaveViewState
and during Render. Less than 25% of the total time is spent loading the XML
into the DataSet.

...........................................................................
Necessity is the plea for every infringement of human freedom.
It is the argument of tyrants; it is the creed of slaves.
-William Pitt, British prime-minister (1759-1806)

-----Original Message-----
From: Click here to reveal e-mail address [mailto:Click here to reveal e-mail address]
Sent: Thursday, 30 May, 2002 11:00 AM
To: aspngspeed
Subject: [aspngspeed] Re: DataGrid vs. XML Performance

I am willing to bet that populating the DataSet is what is taking so long.
Those things are real pigs when it comes to read only work in ASP.
Your problem it not the DataGrid, but the DataSet.
I am not real sharp on XML, so I am not sure about the fastest way to get
XML Doc elements into a collection that can be bound to a DataGrid.
tc

-----Original Message-----
From: Rangi Keen [mailto:Click here to reveal e-mail address]
Sent: Thursday, May 30, 2002 9:47 AM
To: aspngspeed
Subject: [aspngspeed] Re: DataGrid vs. XML Performance
I have two files: DataGrid.aspx and XML.aspx, both with code behind pages in

C#. The aspx pages simply have placeholder controls (<asp:datagrid
id="DataGrid1" runat="server"/> and <asp:xml id="Xml1" runat="server"/>).
Here's the contents of the Page_Load method for DataGrid.aspx.cs:
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("1000InfoItems.xml"));
DataView dv = new DataView(ds.Tables["InfoItem"]);
DataGrid1.DataSource = dv;
DataGrid1.DataBind();
And here's the contents of the Page_Load method for Xml.aspx.cs:
Xml1.DocumentSource = "1000InfoItems.xml";
Xml1.TransformSource = "InfoItems.xsl";
InfoItems.xsl contains a simple XSL template to display a HTML table with
the same number of columns in the same order as the DataGrid creates.
I have tried using XML with both 100 and 1000 items and the timing from the
trace (from page init to page unload) is as follows:
100 Items: DataGrid - 0.19 seconds, XML - 0.02 seconds
1000 Items: DataGrid - 1.8 seconds, XML - 0.15 seconds
...........................................................................
Necessity is the plea for every infringement of human freedom.
It is the argument of tyrants; it is the creed of slaves.
-William Pitt, British prime-minister (1759-1806)
-----Original Message-----
From: Marcie Jones [mailto:Click here to reveal e-mail address]
Sent: Thursday, 30 May, 2002 9:43 AM
To: aspngDataGridRepeaterDatalist
Subject: [aspngdatagridrepeaterdatalist] Re: DataGrid vs. XML
Performance
That sounds like an interesting experiment! Can you
share your results (exact times) with the list, and
maybe the source code for your two options?
Marcie
--- Rangi Keen <Click here to reveal e-mail address> wrote:
[Original message clipped]

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
| [aspngdatagridrepeaterdatalist] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngdatagridrepeaterdatalist.asp =
JOIN/QUIT
| [aspngspeed] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngspeed.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives
| [aspngspeed] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngspeed.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives
| [aspngspeed] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngspeed.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

| [aspngspeed] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngspeed.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Steven A Smith (VIP)
This is a known issue with using the controls built into ASP.NET. You
should grab the performance slides from Scott Guthrie's website at
http://eraserver.net/scottgu/ where he talks about this and also describes
how to build a faster version of the datagrid by overriding its render
method (instead of recursing through its controls collection and allowing
all of its children to render themselves).

The end message - using controls is the recommended way to build web
applications because it makes doing so simpler and easier both at dev time
and maintenance time. However, there is a perf cost associated with this,
and when perf is the absolute necessity, controls should be avoided and
replaced with simple output to the response stream.

Steve

Steven Smith, MCSE+Internet, Microsoft MVP: ASP.NET
Click here to reveal e-mail address
President, ASPAlliance.com
http://aspalliance.com The #1 ASP.NET Community
http://aspsmith.com ASP.NET Training for ASP Developers

Learning ASP.NET? Get My Book: ASP.NET By Example
http://amazon.com/exec/obidos/ASIN/0789725622/stevenatorasp/
----- Original Message -----
From: "Rangi Keen" <Click here to reveal e-mail address>
To: "aspngspeed" <Click here to reveal e-mail address>
Sent: Thursday, May 30, 2002 12:23 PM
Subject: [aspngspeed] Re: DataGrid vs. XML Performance

[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Scott Guthrie (VIP)
Actually -- I think the reason the XML control is faster here is because
both the xml and xsl files are static ones saved on disk. =20

The ASP.NET XML control under the covers caches these files in
situations like this (setting up an automatic cache invalidation for
file changes). As such, there is significantly less work going on in
this scenario.

If the data was dynamic, and viewstate on the DataGrid was turned off,
then I'd imagine the DataGrid would be faster. =20

Hope this helps,

Scott

-----Original Message-----
From: Steven A Smith [mailto:Click here to reveal e-mail address]=20
Sent: Thursday, May 30, 2002 12:19 PM
To: aspngspeed
Subject: [aspngspeed] Re: DataGrid vs. XML Performance

This is a known issue with using the controls built into ASP.NET. You
should grab the performance slides from Scott Guthrie's website at
http://eraserver.net/scottgu/ where he talks about this and also
describes
how to build a faster version of the datagrid by overriding its render
method (instead of recursing through its controls collection and
allowing
all of its children to render themselves).

The end message - using controls is the recommended way to build web
applications because it makes doing so simpler and easier both at dev
time
and maintenance time. However, there is a perf cost associated with
this,
and when perf is the absolute necessity, controls should be avoided and
replaced with simple output to the response stream.

Steve

Steven Smith, MCSE+Internet, Microsoft MVP: ASP.NET
Click here to reveal e-mail address
President, ASPAlliance.com
http://aspalliance.com The #1 ASP.NET Community
http://aspsmith.com ASP.NET Training for ASP Developers

Learning ASP.NET? Get My Book: ASP.NET By Example
http://amazon.com/exec/obidos/ASIN/0789725622/stevenatorasp/
----- Original Message -----
From: "Rangi Keen" <Click here to reveal e-mail address>
To: "aspngspeed" <Click here to reveal e-mail address>
Sent: Thursday, May 30, 2002 12:23 PM
Subject: [aspngspeed] Re: DataGrid vs. XML Performance

> I tried that already and it makes very little difference in the
timing.
[Original message clipped]

...
[Original message clipped]

XML
[Original message clipped]

...
[Original message clipped]

in
[Original message clipped]

the
[Original message clipped]

...
[Original message clipped]

=3D
[Original message clipped]

| [aspngspeed] member Click here to reveal e-mail address =3D YOUR ID
| http://www.asplists.com/asplists/aspngspeed.asp =3D JOIN/QUIT
| http://www.asplists.com/search =3D SEARCH Archives

Reply to this message...
Vote that this is a GOOD answer...
 
 
 
System.Data.DataSet
System.Data.DataView
System.Web.UI.WebControls.DataGrid
System.Web.UI.WebControls.Xml
System.Windows.Forms.DataGrid




Ad
BootFX
Reliable and powerful .NET application framework.
iOS, Android and Windows Phone Development Training and Consultancy
Hosted by RackSRV Communications
 
Multimobile Development: Building Applications for any Smartphone
Copyright © AMX Software Ltd 2008-2010. Portions copyright © Matthew Baxter-Reynolds 2001-2010. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - 4.0.30129.1734