[FW][FIX] *: Compute max/min on huge arrays #3952
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an extension of PR #1217. Navigators (or rather javascript engines) have a limit to the number of function arguments 1.
We sometimes have to use Math.max and Math.min functions (which are subject to this limitation) on every cell/column/row which means that we are functionally limited.
E.g. If we take the limitation of Chrome, we could only process 117k rows, which is not such a huge number if we consider the situation of a user importing their data.
This revision introduces wrappers
largeMax
andlargeMin
which take an 1-D array (a single argument) and find the maximum (resp. minimum) present in that list. For arrays with les than a 100K cells, the wrapper will still call Math.max as its implementation is most of the time faster.Task: 3802691
Description:
description of this task, what is implemented and why it is implemented that way.
Task: : TASK_ID
review checklist
Forward-Port-Of: #3951
Forward-Port-Of: #3907
Footnotes
Experimentally, that limit is 117k on Google Chrome and 501k on Firefox. ↩