Skip to content

Dont use kotlin reflection (#1544) #1851

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

Open
wants to merge 2 commits into
base: community
Choose a base branch
from
Open

Conversation

kzotin
Copy link

@kzotin kzotin commented Oct 31, 2024

Kotlin reflection is super slow on some old devices (~20seconds on cold start, see #1544 ), which is a blocker for us after migrating from realm-java to kotlin.

We've got such device, and fix was verified there

Copy link

cla-bot bot commented Oct 31, 2024

Realm welcomes all contributions! The only requirement we have is that, like many other projects, we need to have a Contributor License Agreement (CLA) in place before we can accept any external code. Our own CLA is a modified version of the Apache Software Foundation’s CLA. Our records show that CLA has not been signed by @kzotin. Please submit your CLA electronically using our Google form so we can accept your submissions. After signing the CLA you can recheck this PR with a @cla-bot check comment. The GitHub usernames you file there will need to match that of your Pull Requests. If you have any questions or cannot file the CLA electronically, make a comment here and we will be happy to help you out.

@kzotin
Copy link
Author

kzotin commented Oct 31, 2024

PS. I've submitted the CLA form yesterday

@stavfx
Copy link
Contributor

stavfx commented Nov 1, 2024

@cla-bot check

Copy link

cla-bot bot commented Nov 1, 2024

Realm welcomes all contributions! The only requirement we have is that, like many other projects, we need to have a Contributor License Agreement (CLA) in place before we can accept any external code. Our own CLA is a modified version of the Apache Software Foundation’s CLA. Our records show that CLA has not been signed by @kzotin. Please submit your CLA electronically using our Google form so we can accept your submissions. After signing the CLA you can recheck this PR with a @cla-bot check comment. The GitHub usernames you file there will need to match that of your Pull Requests. If you have any questions or cannot file the CLA electronically, make a comment here and we will be happy to help you out.

Copy link

cla-bot bot commented Nov 1, 2024

The cla-bot has been summoned, and re-checked this pull request!

@stavfx
Copy link
Contributor

stavfx commented Nov 5, 2024

@kzotin I think you signed the form as "@kzotin" instead of "kzotin" and that's why the cla-bot is still failing

@MrJohn10
Copy link

@cla-bot check

@cla-bot cla-bot bot added the cla: yes label Jan 17, 2025
Copy link

cla-bot bot commented Jan 17, 2025

The cla-bot has been summoned, and re-checked this pull request!

@clementetb clementetb added the no-jira-ticket Skip checking the PR title for Jira reference label Jan 20, 2025
@clementetb
Copy link
Contributor

Would you mind adding a changelog entry to the PR?

@kzotin
Copy link
Author

kzotin commented Jan 21, 2025

Updated the changelog

}

return companion
}

Choose a reason for hiding this comment

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

We tested this fix in our project. The fix makes realm configuration creating much faster, but it slows down some queries. If realmObjectCompanionOrNull called with Double::class then this function works much slower (more than on 50%). Most likely because of Class.forName() is called two times on every realmObjectCompanionOrNull function call.

Copy link

Choose a reason for hiding this comment

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

Double::class implements Parcelable in your case?) Twice call can be only for classes that implements Parcelable and only once when warm up the cache

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes no-jira-ticket Skip checking the PR title for Jira reference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants