Coder Social home page Coder Social logo

Comments (7)

Issues-translate-bot avatar Issues-translate-bot commented on May 28, 2024

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Initial list

  • Is this really a problem?
  • I've searched Github Issues but haven't found any similar issues.

Affected packages and versions

dev

Reproduction steps

  1. Modify the examples/src/sheets/main.ts file, initialize the blank sheet, and change the code as follows:
//univer.createUniverSheet(DEFAULT_WORKBOOK_DATA_DEMO);
univer.createUniverSheet({});
  1. Run the pnpm dev:demo command to start the development service
  2. Open the browser, visit http://localhost:3002, and put a breakpoint on line 24 in the packages/engine-formula/src/functions/math/sum/index.ts file
  3. Refresh the current page and find that the sum function has been executed four times.
  4. When you click a cell to switch selections, add a new worksheet, or modify the style of any cell (not the value), the Sum function will be executed twice.

*Additional instructions:
By looking at the call stack, I found that it was triggered on line 145 of the packages/sheets-ui/src/controllers/status-bar.controller.ts file.

Expected behavior

  1. Only execute the Sum function 1 times during initialization
  2. Execute the Sum function 1 times when switching worksheets
  3. When only changing the selection and cell styles, the Sum function is not executed.
  4. When modifying the cell value, execute the Sum function 1 times

Actual behavior

  1. The Sum function was executed 4 times during initialization.
  2. The Sum function was executed 2 times when switching worksheets.
  3. When modifying the selection and cell style, the Sum function was executed 2 times
  4. When modifying the cell value, the Sum function was executed 2 times

Running environment

Chrome

operating system

macOS

Build tools

esbuild, Vite

from univer.

Dushusir avatar Dushusir commented on May 28, 2024

@yuhongz 帮忙看看是否有status bar 的计算是否有优化空间。

from univer.

Issues-translate-bot avatar Issues-translate-bot commented on May 28, 2024

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The formula calculation does currently have a problem with too many calls, and will be optimized later.

@yuhongz Please help me see if there is room for optimization in the calculation of the status bar.

from univer.

yuhongz avatar yuhongz commented on May 28, 2024

发现不必要的计算,已在这个 PR #1353 优化掉了。
修改样式会导致重新计算是在预期中的行为,因为修改样式和修改值都是使用 SetRangeValueMutation,要区分开来需要用更细粒度的比较,也会带来性能负担

from univer.

Issues-translate-bot avatar Issues-translate-bot commented on May 28, 2024

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Unnecessary calculations were found and have been optimized away in this PR #1353.
Modifying the style will cause recalculation, which is expected behavior, because both modifying the style and modifying the value use SetRangeValueMutation. To distinguish them, you need to use a more fine-grained comparison, which will also bring a performance burden.

from univer.

iamyunsin avatar iamyunsin commented on May 28, 2024

发现不必要的计算,已在这个 PR #1353 优化掉了。 修改样式会导致重新计算是在预期中的行为,因为修改样式和修改值都是使用 SetRangeValueMutation,要区分开来需要用更细粒度的比较,也会带来性能负担

但是status bar是公共能力,如果表格数据特别多的情况下,应该会产生CPU资源浪费和性能问题(即使计算都放到Web Worker中,也可能产生性能问题,看看是否需要构造一个大数据量的表格来做性能测试吧)。

from univer.

Issues-translate-bot avatar Issues-translate-bot commented on May 28, 2024

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Unnecessary calculations were found and have been optimized in this PR #1353. Modifying the style will cause recalculation, which is expected behavior, because both modifying the style and modifying the value use SetRangeValueMutation. To distinguish them, you need to use a more fine-grained comparison, which will also bring a performance burden.

However, the status bar is a public capability. If there is a lot of table data, it may cause a waste of CPU resources and performance problems (even if the calculations are all done in the Web Worker, performance problems may occur. Check whether you need to construct a large amount of data. Use the form to do performance testing).

from univer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.