-
Notifications
You must be signed in to change notification settings - Fork 19
Adding getItemValuesById() method #42
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
base: master
Are you sure you want to change the base?
Conversation
Why not using the original method getItemById, then simply create the array of values parsing the item? |
I tested in a 44K cells table (30 columns * 1300 rows), and it has a 20x better performance (from 21s to 1.1s). So it's a really convenient method when search performance matters! |
Just realized this is only a function and not a method of the Table object. I do not understand what it is supposed to do exactly. I can imagine how a binary search could speed things up in some cases, but I have difficulties to grasp the use for it here. An example would help? The time you save is most likely because you're not creating a Sheetfu table. The index feature of the Sheetfu object is really fast, O(1), as those are literally lookups in hash tables (notorious for their speed), but it needs to have the Sheetfu table created. |
Well... indeed, the main save is not creating the Sheetfu table. Basically, the function creates an array for the indexField column and it searches there. The trick saves 20x. Binary search it's not the main save (neither the purpose of the function). I am using it particularly in the LiveOps Calendar Sidebar, so an abstraction of the use would be: Even though it is not related to Table / Item, the arguments are following Sheetfu philosophy and the result (itemValues) easily integrable with other Sheetfu components (as .add() method) |
Since this is not part of Sheetfu Table scope, I feel this could create confusion to whoever uses the library, as we give 2 different ways to do the same thing. We could keep it but it has to be much more documented in the code itself, and explain in which scenarios this solution is better than using the Table object. |
A fast method to query the item values in a large database