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

all: improve memory usage #282

Merged
merged 2 commits into from
Oct 18, 2024
Merged

Conversation

TotallyGamerJet
Copy link
Collaborator

Don't allocate when being called by objc.Send. This is done by just inlining the expansion of the parameters directly into the argument list instead of making a tmp slice.

Use a sync.Pool for syscall15Args struct to save on allocations

func.go Outdated Show resolved Hide resolved
func.go Outdated Show resolved Hide resolved
Copy link
Member

@hajimehoshi hajimehoshi left a comment

Choose a reason for hiding this comment

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

LGTM % comments

Thanks!

})
fn.Set(v)
}

func addValue(v reflect.Value, keepAlive []interface{}, addInt func(x uintptr), addFloat func(x uintptr), addStack func(x uintptr), numInts *int, numFloats *int, numStack *int) []interface{} {
Copy link
Member

Choose a reason for hiding this comment

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

optional: any?

} else {
addInt(0)
for i, v := range args {
if variadic, ok := args[i].Interface().([]interface{}); ok {
Copy link
Member

Choose a reason for hiding this comment

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

Optional: any?

@TotallyGamerJet
Copy link
Collaborator Author

I'll just make another PR that changes interface{} to any

@TotallyGamerJet TotallyGamerJet merged commit 0196f2d into ebitengine:main Oct 18, 2024
24 checks passed
@TotallyGamerJet TotallyGamerJet deleted the allocs branch October 18, 2024 02:32
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