Comments (16)
I'm going to close this. Although realm is somewhat attractive b/c of improved performance, I think v2 improves it enough that this is no longer necessary; it's also unclear just how much we can improve performance just by using realm, I think the bottleneck may be elsewhere. Plus, doing away with an extra react-native link
means this can be used in expo.
from react-native-meteor-offline.
If you look closer, the schema just defines collections and documents, allowing for an artitrary number of collections and an arbitrary document shape, making it more compatible with the "meteor way". I feel like defining a shema for every collection is very "stiff", especially because schema are declared differently in realm than Mongo. Maybe I'll test the stringify stuff, to see if it's really a performance bottleneck. My theory is/was that because I store each doc separately (compared to asyncstorage), keyed by id, it would perform pretty well.
The for loop shouldn't be a problem.
from react-native-meteor-offline.
Right ...
Mmm I don't really know then ...
I will try to make the thing working without going throught the package and compare to the code of connectMeteorRedux.js ...
from react-native-meteor-offline.
Here's a jsperf on JSON.stringify: https://jsperf.com/json-stringify-versions/3
93,759 operations per second should be fast enough :)
Also, looking at the forEach
again, it's just looping through the collections, of which there likely won't be many, so not a lot lost there.
One thing we could try is throttling saves, so they're added in bulk on a timer, instead of on every DDP addition/update/removal (mainly the initial load is the problem, since it fires an 'added' event for every downloaded document.
On the 'restore' side, I still don't know why it's so slow. Is it actual disk write speeds, or... something else? This is the main problem.
from react-native-meteor-offline.
Ahah yes, but there is the parsing process to take into account too :)
[WITHOUT REALM]
I've tried with 10 and 100 objects in Asyncstorage and the performances are totally different ! (stringify and parse)
[WITH REALM]
I have rendered 10 and 100 objects using same schema I used in simple schema on meteor and there are absolutely no problem ! (absolutely no use of stringify)
from react-native-meteor-offline.
Any code you can share?
from react-native-meteor-offline.
Also, I don't really notice a performance issue until over 1000 records
from react-native-meteor-offline.
It was just shitty tests but I will do it :)
from react-native-meteor-offline.
So there's this related issue: realm/realm-js#491
Basically, with the chrome debugger enabled, realm performs much much much slower. Testing this on the example (for which I added a setting that creates 10,000 records), performance is pretty snappy. Give it a shot and let me know how it works.
Hopefully they fix it soon, as never enabling debugger would be rather unfortunate.
from react-native-meteor-offline.
Yes, but even if I remove chrome debugger / or run it on my iphone, it's pretty laggy ...
from react-native-meteor-offline.
How many records are you dealing with, and how big are the objects? I'm seeing next to 0 performance hit for the 10,000 moderate/large objects.
from react-native-meteor-offline.
Sorry for the delay ...
just 100 objects, but with nested objects and arrays inside.
I will provide you an example as soon as I can
from react-native-meteor-offline.
Huh, 100 should be no problem. Is it a repo you can share? It seems like maybe something else is going on
from react-native-meteor-offline.
Yeah but with the error "Document.fields must be of type: string" it won't actually work on my repo ...
from react-native-meteor-offline.
Give v2.0 a try. It has a different API, so be aware of that.
from react-native-meteor-offline.
Cool ! Thanks will have a try this week end :)
from react-native-meteor-offline.
Related Issues (20)
- Last Redux State is not written to disk HOT 5
- _.clone(state) or _.cloneDeep(state.prop) HOT 4
- How to write record HOT 2
- [Error] Expected listener to be a function HOT 2
- Crash when subscribing HOT 1
- How to sync inserts/updates after resuming connection HOT 3
- Package not bundling HOT 3
- Unable to resolve module 'redux-persist' when trying to npm link HOT 1
- 'cleared' field ignored in ddp event listeners HOT 3
- Can't get online insert to work HOT 1
- Create user issues HOT 1
- Subsciptions keep on reloading HOT 1
- MO.user() after successful Meteor.logout() then go offline.
- TypeError: undefined is not an object (evaluating '(0, _reactNativeMeteor.getData)().db[collection].remove') HOT 1
- Cleanup method needed when user logged out and new one connected HOT 3
- undefined is not an object (evaluating 'state[collection][id]') HOT 2
- offline property of MeteorOffline is always false
- with expo sdk32 : invalid attempt to spread non-iterable instance HOT 6
- Can you give me the example of a function component? HOT 1
- Upgrade to meteorrn/core HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-meteor-offline.