-
Notifications
You must be signed in to change notification settings - Fork 585
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
Writing performance regression in 10.12 #4383
Comments
Good catch @somebody32 ! We will start investigating and report when we have an idea of what happened. |
I have investigated it a bit today but haven't reached a conclusion. I have used the script: const Realm = require("realm");
function generate(id) {
return {
id: id.toString(),
triggeredOn: [
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday',
'Sunday',
]
}
};
const schema = {
name: 'Task',
primaryKey: 'id',
properties: {
id: 'string',
triggeredOn: 'string[]',
},
};
const config = {
schema: [schema],
};
const realm = new Realm(config);
realm.write(() => {
for(let i = 0; i < 2500; i++) {
realm.create('Task', generate(i), 'modified');
}
});
process.exit(0); I have profiled the execution using the command: rm -rf default.realm* && xcrun xctrace record --template 'Time Profiler' --target-stdout - --launch -- /Users/kneth/.nvm/versions/node/v16.13.0/bin/node task.js |
I have tried different variations: const Realm = require("realm");
const schema = {
name: 'Task',
primaryKey: 'id',
properties: {
id: 'int',
val: "int",
},
};
const config = {
schema: [schema],
_automaticChangeNotifications: false
};
const realm = new Realm(config);
let start = new Date();
realm.write(() => {
for(let i = 0; i < 25000; i++) {
realm.create('Task', { id: i, val: i }, "modified");
}
});
console.log('Writing Finished', new Date().getTime() - start.getTime());
process.exit(0); const Realm = require("realm");
const Link = {
name: "Link",
properties: {
lid: 'int'
}
};
const Task = {
name: 'Task',
primaryKey: 'id',
properties: {
id: 'int',
lobj: "Link"
},
};
const config = {
schema: [Task, Link],
};
const realm = new Realm(config);
let start = new Date();
realm.write(() => {
for(let i = 0; i < 25000; i++) {
realm.create('Task', { id: i, lobj: { lid: i }}, "modified");
}
});
console.log('Writing Finished', new Date().getTime() - start.getTime());
process.exit(0); At least, on MacOS + node 16 I am not able to reproduce it. |
@kneth I've discovered it on React Native and JSC, would try just on bare node |
@kneth I can't reproduce it on node too, looks like it's RN related only |
Just FYI, @kneth @takameyer, tried with the latest version (10.14), but unfortunately, the problem is still there |
We're having the exact same issue (only on iOS). I created https://github.com/AdamGerthel/realmjsperformance to test it. The individual Here's the test result from the main branch, where version and here's the test on another branch, where version I've also tested |
I have a hunch that this is not js/RN only related, looks like the same problem is in realm-swift around the same update (bumping realm core to 11.8.0+): realm/realm-swift#7734 |
Realm Core v12.0.0 has been released with a partial fix of this regression. We will release a version soon. |
@kneth Great! Is there a way to test it before it's released? So I can verify that it fixes or at least relieves this issue |
@AdamGerthel We have released v10.18.0 with the fix. I leave the issue open to give you a chance to try it out. |
Looking good @kneth! Any idea when the beta (which includes Hermes support) will be bumped? |
@AdamGerthel Thank you for the update.
Likely later this week. |
With the good news from @AdamGerthel I close the issue |
@kneth Any updates on when we can expect a new release of the Hermes-enabled beta? |
@AdamGerthel We are working on #4630 which is required before releasing. |
@kneth FYI, here's the same benchmark as in my previous comment, this time running So it seems the performance has degraded a little again since |
How frequently does the bug occur?
All the time
Description
Hi, while updating my app from 10.11 to 10.13, I found that writing times for one of the tables increased up to 20x.
While debugging, I've managed to create a reproducible example and nailed down that the first affected version is 10.12 and that having an array of strings in the schema is causing it.
The example is based on Realm's TS Example
Task.ts
and then the writing code:
For version < 10.12, I have about 1-2ms for writing, on 10.12+, it doesn't go below 23-25.
Stacktrace & log output
No response
Can you reproduce the bug?
Yes, always
Reproduction Steps
No response
Version
10.12
What SDK flavour are you using?
Local Database only
Are you using encryption?
No, not using encryption
Platform OS and version(s)
iOS 15.2
Build environment
React Native 0.67.3
Cocoapods version
No response
The text was updated successfully, but these errors were encountered: