Friday, July 04, 2008  



 FarPoint Technologies
 (800) 645-5913

 fpsales@fpoint.com



     
 »Spread for Web Forms » Product Tour » Optimize

Previous Optimizing Performance Next

The default behavior of Spread makes it very easy to quickly publish your information on-line. However, there may be times when you need to fine tune Spread's behavior when working with large amounts of data to present it to your customer in the quickest possible time. Fortunately, Spread makes this easy to do.

Spread provides several methods to dramatically increase the performance of your web applications and decrease the size of the download page:
  1. Use style sheets
  2. Use State Management
  3. Program against the Models instead of Helper Objects
  4. Use Named Styles


Style Sheets
You can use style sheets to decrease the size of your download page to remove many of the verbose in-line style attributes and replacing them with CSS Styles.

There are two ways to use style sheets in the Spread. The easiest way is by setting the RenderCSSClass property to True. When this property is set to True, the Spread automatically creates CSS Styles for the rendering of the resulting table's styles.

The other way is to use your own CSS Style sheet for use by the cells, columns, rows, or spreadsheet object. Then you simply assign your own defined style to any part of Spread.



State Management
If you will be working with large amounts of data, you will want to use State Management to manage the size of the ViewState. By default, all data is stored in the ViewState of the page. The larger the ViewState size, the larger the download page will be and the slower the page will be to respond.

For example, if you are displaying 10,000 records from a database, by default, the page will store all records in its ViewState. All this information has to be downloaded by the client and sent back to the server on every new page request, thus slowing your applications response time.

Spread offers several different options for managing the ViewState, making the download time almost instantaneous regardless of the size of your database:
  • Saving Data to the ViewState
  • Saving Data to the Session State
  • Saving Data to SQL Server
  • Loading Data for each Page Request
In depth discussions of these topics can be found in our technical paper or in our video:
http://www.fpoint.com/support/whitep/statemg/SpWebStateMgmt.pdf
http://www.clubfarpoint.com/FarPointSupportSite/Modules/Resources/videos.aspx?id=12




Programming Models
While programming against the helper objects is much easier and allows you learn the capabilities of Spread very quickly, your application will take a performance hit compared to calling directly into the models.

The following code samples produce the same result - setting the text 'FarPoint' into a cell:

Using helper objects:
FpSpread1.Sheets(0).Cells(0, 0).Text = "FarPoint"

Using the models:
FpSpread1.Sheets(0).DataModel.SetValue(0,0,"FarPoint")

However, using the helper objects will be slower as it has to call into the models to perform the action. A few helper object calls will not make much of a difference. But imagine 100,000 calls. You can eliminate this extra step by programming directly against the models and thus giving your application a performance boost.

.Text vs .Value
When using the helper object, use the Value property instead of the Text property where possible. Take the following for example:

FpSpread1.Sheets(0).Cells(0, 0).Text = "FarPoint"

FpSpread1.Sheets(0).Cells(0, 0).Value = "FarPoint"

Both calls will place the text 'FarPoint' in cell A1. However, the second call using the Value property will be faster than using the Text property. When using the Text property in a General cell type, Spread's formatter will first parse the data to see what type it is (date, number, etc). Calling the Value property will place the data directly into the data model.no parsing required.




Use Named Styles
Named Styles allow you to define a certain style (for example; fonts, colors, cell types, etc.) and share the style with other cells. This greatly reduces the coding and allows you to easily modify the master style and it will update all related styles accordingly.

Using NamedStyles, like using the Object Models, will help performance on the server by allocating less memory for the cells, columns, rows, etc. If you have several cells that you want to be red with yellow text, and these cells are not in a block, then using NamedStyles would create one 'style' object to be shared between all the cells you set this for.


    
 Have a question?
Have a Question? Ask Us!
Subscribe to the RSS feed!RSS Subscribe
 

 
SD Times 'TOP 100' Industry Innovator - Read the press release (pdf)

Tour Home
AJAX Support
Cell Merging
Conditional Formatting
Customer Usability
Customization
Data Binding
Editing
Excel Compatibility
Filtering
Formulas
Frozen Rows & Columns
Grouping
Hierarchy
Import / Export
Interaction
Load on Demand
Move Columns
Object Model
Operation Modes
Optimizing
Order Entry Sample
Protect that Data
Searching
Sheets
Skins
Sorting
Spread Designer
Unbound Mode
Worksheet
Please rate tour

Copyright © 1991-2007 FarPoint Technologies, Inc. All rights reserved. All names are property of their respective owners.