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

Avoid allocating a new slice on every call to drawSingleFrame #4375

Merged
merged 2 commits into from
Nov 9, 2023

Conversation

dweymouth
Copy link
Contributor

@dweymouth dweymouth commented Nov 8, 2023

Description:

Preallocate a slice to reuse to avoid memory allocations in a tight loop

Side note - after testing this in Supersonic for awhile it seems like the GC is more inclined to give excess memory back to the OS now since we're not allocating so frequently :)

Checklist:

  • Tests included.
  • Lint and formatter run with no errors.
  • Tests all pass.

@dweymouth dweymouth requested a review from Jacalz November 8, 2023 01:22
@coveralls
Copy link

coveralls commented Nov 8, 2023

Coverage Status

coverage: 65.078% (+0.005%) from 65.073%
when pulling 36b38b6 on dweymouth:drawsingleframe-allocs
into e250829 on fyne-io:develop.

Copy link
Member

@Jacalz Jacalz left a comment

Choose a reason for hiding this comment

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

Thanks. That's a good improvement. Just one minor note inline :)

internal/driver/glfw/loop.go Outdated Show resolved Hide resolved
Co-authored-by: Jacob Alzén <jacalz@tutanota.com>
@dweymouth dweymouth requested a review from Jacalz November 8, 2023 21:56
@dweymouth dweymouth merged commit 65cc2a3 into fyne-io:develop Nov 9, 2023
10 of 11 checks passed
@dweymouth dweymouth deleted the drawsingleframe-allocs branch November 9, 2023 00:36
dweymouth added a commit to dweymouth/fyne that referenced this pull request Nov 10, 2023
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.

3 participants