Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evaluate calculation chain #2172

Merged
merged 12 commits into from Sep 25, 2023
Merged

Evaluate calculation chain #2172

merged 12 commits into from Sep 25, 2023

Conversation

jahav
Copy link
Member

@jahav jahav commented Sep 23, 2023

Replace the evaluation of a formula using a recursive algorithm with a calculation chain. Calculation chain evaluates a single formula at a time and if formula needs data from another formula, it stops evaluation of the current formula and reorders the chain, so the supporting formula is positioned before the dependent formula (that is also reason why first calculation is often slower-order is not yet determined, and also why is the chain is saved to the file).

Draft/WIP PR, needs TLS, but added, because I like looking at changes on GitHub.

Things that will be fixed later:

  • Stopping evaluation of a formula with an exception when it needs a dirty cell value. Exceptions are really slow and are counter to the goal of fast calc engine, but a better a mechanism to stop evaluation of a formula will be in different PR.
  • Recreation of a dependency tree and calculation chain when structure of a workbook changes. This will also be fixed in separate PR. For now, recreating both is a working solution.

…ormulas and thus a place to put other logic of keeping up the calculation chain, dirty flag and dependency tree up to date.
…ction. The primary reason is that DependencyTree should be part of CalcEngine and CalcEngine doesn't have workbook as a ctor dependency. At this time, injecting the ctor dependency is not good, because CalcEngine is used in many places without acces to workbook.
@jahav jahav added this to the v0.103 milestone Sep 23, 2023
@jahav jahav marked this pull request as draft September 24, 2023 00:05
@jahav jahav changed the title Draft: Evaluate calculation chain Evaluate calculation chain Sep 25, 2023
@jahav jahav marked this pull request as ready for review September 25, 2023 22:43
@jahav jahav merged commit b9beb3e into develop Sep 25, 2023
4 checks passed
@jahav jahav deleted the evaluate-calculation-chain branch September 25, 2023 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant