Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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
@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