Uploaded image for project: 'ZK Spreadsheet'
  1. ZK Spreadsheet
  2. ZSS-1283

Improve the performance for initializing cells with formulas

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Done
    • Icon: Normal Normal
    • 3.9.1
    • 3.9.0
    • None
    • Security Level: Jimmy
    • None
    • Sprint 6

      user scenario

      Like ZSS-867, users load an Excel file as a format template and initialize lots of cells with formulas from a database.

      steps to reproduce

      1. run the attached zul

      actual result

      it takes a long time to initialize the cells.

      debug info

      • like ZSS-867, when using Range API, it takes extra cost at handlePrecedentUpdate() because clearer is not null.
        /*package*/ class ModelUpdateUtil {
        ...
        	//ZSS-1047: (side-effect of ZSS-988 and ZSS-1007 which consider setHidden() of SUBTOTAL() function)
        	// see ColumnArrayImpl#setHidden()
        	/*package*/ static void handlePrecedentUpdate(SBookSeries bookSeries, Ref precedent, boolean includePrecedent){
        		//clear formula cache (that reval the unexisted sheet before
        		FormulaCacheCleaner clearer = FormulaCacheCleaner.getCurrent();
        		ModelUpdateCollector collector = ModelUpdateCollector.getCurrent();
        		Set<Ref> dependents = null; 
        		//get table when collector and clearer is not ignored (in import case, we should ignore clear cahche)
        		if(collector!=null || clearer!=null || bookSeries.isAutoFormulaCacheClean()){
        			DependencyTable table = ((AbstractBookSeriesAdv)bookSeries).getDependencyTable();
        			dependents = table.getEvaluatedDependents(precedent); 
        		}
        

      Please refer to attached hotspot.png

      workaround

      1. like Importer, use SCell.setFormulaValue(), see fillFormulaAtInternalSheet() in PopulatePerformanceComposer

      possible solution

      1. also update the formula dependencies upon Range.setAutoRefresh()

        1. time.png
          time.png
          107 kB
        2. PopulatePerformanceComposer.java
          6 kB
        3. populate_performance_issue.zul
          0.7 kB
        4. hotspot.png
          hotspot.png
          564 kB
        5. Clock.java
          3 kB

            henrichen henrichen
            hawk hawk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: