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

GODRIVER-2887 bson: remove use of reflect.Value.MethodByName #1308

Merged
merged 1 commit into from
Jul 6, 2023

Conversation

charlievieth
Copy link
Contributor

@charlievieth charlievieth commented Jun 28, 2023

GODRIVER-2887

Summary

Remove all uses of reflect.Value.MethodByName since it prevents dead code elimination. This causes binaries built with the mongodb/mongo-go-driver library to be larger than they need to be.

All occurrences of reflect.Value.MethodByName are replaced with type assertions.

Source: https://go.dev/src/cmd/link/internal/ld/deadcode.go#L293

Background & Motivation

Reduce the size of binaries built with mongodb/mongo-go-driver.

Remove all uses of reflect.Value.MethodByName since it prevents deadcode
elimination. This causes binaries built with the bson library to be
larger than they need to be.

Source: https://go.dev/src/cmd/link/internal/ld/deadcode.go#L293
@matthewdale matthewdale changed the title bson: remove use of reflect.Value.MethodByName GODRIVER-2887 bson: remove use of reflect.Value.MethodByName Jun 30, 2023
Copy link
Collaborator

@matthewdale matthewdale left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@charlievieth
Copy link
Contributor Author

Thank you all for the quick review!

@qingyang-hu qingyang-hu merged commit 65cd095 into mongodb:master Jul 6, 2023
prestonvasquez pushed a commit to prestonvasquez/mongo-go-driver that referenced this pull request Aug 1, 2023
prestonvasquez pushed a commit to prestonvasquez/mongo-go-driver that referenced this pull request Aug 1, 2023
prestonvasquez pushed a commit to prestonvasquez/mongo-go-driver that referenced this pull request Aug 1, 2023
prestonvasquez pushed a commit to prestonvasquez/mongo-go-driver that referenced this pull request Aug 2, 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.

4 participants