Skip to content

Feature/improve performance by using estimated slice size#15

Open
vikbert wants to merge 3 commits into
pedramktb:mainfrom
vikbert:feature/improve-performance-by-using-estimated-slice-size
Open

Feature/improve performance by using estimated slice size#15
vikbert wants to merge 3 commits into
pedramktb:mainfrom
vikbert:feature/improve-performance-by-using-estimated-slice-size

Conversation

@vikbert

@vikbert vikbert commented Mar 7, 2026

Copy link
Copy Markdown

@pedramktb

In this PR contains a tiny changes to eliminate dynamic memory allocations during pagination queries. The optimization reduces unnecessary slice growth operations by pre-allocating the exact capacity needed upfront. In case of large data set, it brings 30-60% performance improvement.

What do you think about it?

Xun Zhou and others added 3 commits March 7, 2026 08:57
- Modified fetch() method to accept estimatedSize parameter
- Pre-allocate results slice with capacity of pagOpts.Limit+1
- Eliminates dynamic slice growth during pagination queries
- Expected performance improvement: 20-50% for large result sets

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@pedramktb pedramktb added the enhancement New feature or request label Mar 15, 2026
@vikbert

vikbert commented Mar 19, 2026

Copy link
Copy Markdown
Author

done

@vikbert vikbert closed this Mar 19, 2026
@vikbert vikbert reopened this Mar 19, 2026
@vikbert

vikbert commented Mar 19, 2026

Copy link
Copy Markdown
Author

Will you add me to the group who can write in the repo, so that I can see the button "Merge pull request" to merge the PR?

@vikbert

vikbert commented Apr 21, 2026

Copy link
Copy Markdown
Author

ship it

@vikbert vikbert closed this Apr 21, 2026

@vikbert vikbert left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

approved

@vikbert vikbert reopened this Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants