Render and Cache"

From Documentation
m
m (correct highlight (via JWB))
 
(21 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Template:UnderConstruction}}
+
{{ZKSpreadsheetEssentialsPageHeader}}
 +
 
 +
 
 +
{{Deprecated|url=http://books.zkoss.org/wiki/ZK_Spreadsheet_Essentials}}
 +
 
  
{{ZKSpreadsheetEssentialsPageHeader}}
 
  
 
__TOC__
 
__TOC__
  
 
===Purpose===
 
===Purpose===
ZK Spreadsheet provide various setting
+
ZK Spreadsheet provides various settings to cache rendered cells and sheets, optimal values could be provided to achieve maximum performance.
  
 
===Client Cache===
 
===Client Cache===
Use client cache will improve performance when user switch between sheet.
+
Using client cache improves the performance when users switch between sheets.
  
ZK Spreadsheet enable cache by default. To disable cache, use <javadoc directory="zss"  method="setClientCacheDisabled">org.zkoss.zss.ui.Spreadsheet</javadoc>
+
ZK Spreadsheet enables cache by default. To disable cache, use <javadoc directory="zss"  method="setClientCacheDisabled">org.zkoss.zss.ui.Spreadsheet</javadoc>
  
 
===Max Rendered Cell Size===
 
===Max Rendered Cell Size===
ZK Spreadsheet load cell data and also prune invisible cells as well when user scrolling sheet. The default setting is 8000, means client side will prune cells only when total cell number is more then 8000. Set by <javadoc directory="zss"  method="setMaxRenderedCellSize">org.zkoss.zss.ui.Spreadsheet</javadoc>
+
ZK Spreadsheet loads cell data and also prunes invisible cells (DOM Elements) when users scrolls through the sheet. The default setting is 8000, meaning client side will prune cells only when the total number of cells exceeds 8000.
 +
 
 +
Ideally, if the browser at the client side is able to support enough memory space, pruning no cells would provide faster response time as there would be no need for re-creating all loaded cells. However, there are always limitations in a browser, if the number of rendered cells exceeds what the browser can handle, the browser may become slow and unstable.
 +
 
 +
Set proper size by <javadoc directory="zss"  method="setMaxRenderedCellSize">org.zkoss.zss.ui.Spreadsheet</javadoc>
  
Ideality, if browser could support, no prune cell would provide fest response effect, since all loaded cell no need to re-create. However, browser has limitation, if loaded cell number is outnumber then browser could handle, browser may become slow and unstable.
+
===Pre-load Size===
 +
ZK Spreadsheet loads cell data based on the <b>preloadRowSize/preloadColSize</b> attribute when loading sheets and on the action of scrolling.
  
===Preload Size===
+
In theory, increasing pre-load size will improve response time. Since cell data has been preloaded, there is no need to send request back to server again; thus decreasing the number of client/server communications at the same time. However, if preload size exceeds more than needed, client side may need extra CPU time to process those extra data. For example, with a screen display which can show 50 rows * 30 columns, setting preload size to 500 rows * 300 columns simply wastes a lot of CPU time at the client side to process those extra invisible cells.  
ZK Spreadsheet load cell data base on preloadRowSize/preloadColSize attribute when load sheet and scrolling.
 
  
In theory, increase preload size will improve response time since cell data may preloaded, then no need to send request to server, it will also decrease the number of client/server communcation. However, if preload size is outnumber then needed, client side may need extra time to process extra data. For example, a screen display 50 rows * 30 columns, but preload size is 500 rows * 300 columns, then client side need to process many extra invisible data. Developer could adjust the preload size base on sheet's data size.  
+
Set proper preload size based on the sheet's data size by <javadoc directory="zss"  method="setPreloadRowSize">org.zkoss.zss.ui.Spreadsheet</javadoc> and <javadoc directory="zss"  method="setPreloadColumnSize">org.zkoss.zss.ui.Spreadsheet</javadoc>
  
 
===ZUML===
 
===ZUML===
  
===Composer===
+
<source lang="xml" highlight="4,5,6,7">
 +
<zk>
 +
<window vflex="1" width="100%">
 +
<spreadsheet
 +
clientCacheDisabled="false"
 +
maxRenderedCellSize="15000"
 +
preloadColumnSize="60"
 +
preloadRowSize="80"
 +
id="spreadsheet" vflex="true" width="100%" showSheetbar="true"
 +
src="/WEB-INF/excel/config/ZSS-demo_sample.xlsx" maxcolumns="100" maxrows="1000"
 +
></spreadsheet>
 +
</window>
 +
</zk>
 +
</source>
 +
 
 +
View complete source of ZUML [https://code.google.com/p/zkbooks/source/browse/trunk/zssessentials/examples/WebContent/config/renderAndCache.zul renderAndCache.zul]
  
 
=Version History=
 
=Version History=

Latest revision as of 12:56, 19 January 2022



Stop.png This article is out of date, please refer to http://books.zkoss.org/wiki/ZK_Spreadsheet_Essentials for more up to date information.


Purpose

ZK Spreadsheet provides various settings to cache rendered cells and sheets, optimal values could be provided to achieve maximum performance.

Client Cache

Using client cache improves the performance when users switch between sheets.

ZK Spreadsheet enables cache by default. To disable cache, use Spreadsheet.setClientCacheDisabled

Max Rendered Cell Size

ZK Spreadsheet loads cell data and also prunes invisible cells (DOM Elements) when users scrolls through the sheet. The default setting is 8000, meaning client side will prune cells only when the total number of cells exceeds 8000.

Ideally, if the browser at the client side is able to support enough memory space, pruning no cells would provide faster response time as there would be no need for re-creating all loaded cells. However, there are always limitations in a browser, if the number of rendered cells exceeds what the browser can handle, the browser may become slow and unstable.

Set proper size by Spreadsheet.setMaxRenderedCellSize

Pre-load Size

ZK Spreadsheet loads cell data based on the preloadRowSize/preloadColSize attribute when loading sheets and on the action of scrolling.

In theory, increasing pre-load size will improve response time. Since cell data has been preloaded, there is no need to send request back to server again; thus decreasing the number of client/server communications at the same time. However, if preload size exceeds more than needed, client side may need extra CPU time to process those extra data. For example, with a screen display which can show 50 rows * 30 columns, setting preload size to 500 rows * 300 columns simply wastes a lot of CPU time at the client side to process those extra invisible cells.

Set proper preload size based on the sheet's data size by Spreadsheet.setPreloadRowSize and Spreadsheet.setPreloadColumnSize

ZUML

<zk>
	<window vflex="1" width="100%">
		<spreadsheet 
			clientCacheDisabled="false"
			maxRenderedCellSize="15000"
			preloadColumnSize="60"
			preloadRowSize="80"
			id="spreadsheet" vflex="true" width="100%" showSheetbar="true"
			src="/WEB-INF/excel/config/ZSS-demo_sample.xlsx" maxcolumns="100" maxrows="1000"
			></spreadsheet>
	</window>
</zk>

View complete source of ZUML renderAndCache.zul

Version History

Last Update : 2022/01/19


Version Date Content
2.3.0 April, 2012 Client cache/Max Rendered Cell Size
     


All source code listed in this book is at Github.


Last Update : 2022/01/19

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.