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

use range indexing to get rows subset #514

Merged
merged 1 commit into from
Nov 23, 2023
Merged

use range indexing to get rows subset #514

merged 1 commit into from
Nov 23, 2023

Conversation

koperagen
Copy link
Collaborator

I noticed that previous implementation took 200 ms to execute on 10m rows dataframe because it iterates over all rows. Indexing should improve it

@@ -60,7 +59,7 @@ public object KotlinNotebookPluginUtils {
* It's used for example for dynamic pagination in Kotlin Notebook Plugin.
*/
public fun getRowsSubsetForRendering(df: AnyFrame, startIdx: Int, endIdx: Int): DisableRowsLimitWrapper =
DisableRowsLimitWrapper(df.filter { it.index() in startIdx until endIdx })
DisableRowsLimitWrapper(df[startIdx until endIdx])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool place to try the new ..< operator :D

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new shiny! i'll use it indeed

Copy link
Collaborator

@Jolanrensen Jolanrensen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

funny how such a simple change can cause such a great impact :)

@koperagen koperagen merged commit 7232b07 into master Nov 23, 2023
1 check was pending
@koperagen koperagen deleted the get-subset-fix branch August 26, 2024 13:48
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.

2 participants