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

Object3D: Unify .userData check in toJSON(). #25026

Merged
merged 4 commits into from
Dec 6, 2022
Merged

Conversation

Hoodgail
Copy link
Contributor

Description

Prevents High CPU usage for big userData's on .toJSON

Prevents High CPU usage for big userData's on .toJSON
Object.keys creates a whole new array of every keys, this might be an issue for some people if their data has a lot of keys
@Hoodgail Hoodgail changed the title Use Object.keys rather than JSON.stringify Object3D: Use a different method to check if .userData is empty Nov 27, 2022
src/core/Object3D.js Outdated Show resolved Hide resolved
@Hoodgail
Copy link
Contributor Author

We could simply just use Object.keys( ... ) for now.

@Mugen87
Copy link
Collaborator

Mugen87 commented Dec 6, 2022

Merging this for now. I'm someone wants to refactor the test of userData, please file a new PR.

@Mugen87 Mugen87 merged commit 3500e31 into mrdoob:dev Dec 6, 2022
@Mugen87 Mugen87 added this to the r148 milestone Dec 6, 2022
@Mugen87 Mugen87 changed the title Object3D: Use a different method to check if .userData is empty Object3D: Unify .userData check in toJSON(). Dec 6, 2022
@Mugen87 Mugen87 mentioned this pull request Dec 6, 2022
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