{"action":"created","issue":{"url":"https://api.github.com/repos/Nozbe/WatermelonDB/issues/129","repository_url":"https://api.github.com/repos/Nozbe/WatermelonDB","labels_url":"https://api.github.com/repos/Nozbe/WatermelonDB/issues/129/labels{/name}","comments_url":"https://api.github.com/repos/Nozbe/WatermelonDB/issues/129/comments","events_url":"https://api.github.com/repos/Nozbe/WatermelonDB/issues/129/events","html_url":"https://github.com/Nozbe/WatermelonDB/issues/129","id":377575643,"node_id":"MDU6SXNzdWUzNzc1NzU2NDM=","number":129,"title":"Debug x Release - Performance ","user":{"login":"rafaelcamaram","id":9087886,"node_id":"MDQ6VXNlcjkwODc4ODY=","avatar_url":"https://avatars1.githubusercontent.com/u/9087886?v=4","gravatar_id":"","url":"https://api.github.com/users/rafaelcamaram","html_url":"https://github.com/rafaelcamaram","followers_url":"https://api.github.com/users/rafaelcamaram/followers","following_url":"https://api.github.com/users/rafaelcamaram/following{/other_user}","gists_url":"https://api.github.com/users/rafaelcamaram/gists{/gist_id}","starred_url":"https://api.github.com/users/rafaelcamaram/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafaelcamaram/subscriptions","organizations_url":"https://api.github.com/users/rafaelcamaram/orgs","repos_url":"https://api.github.com/users/rafaelcamaram/repos","events_url":"https://api.github.com/users/rafaelcamaram/events{/privacy}","received_events_url":"https://api.github.com/users/rafaelcamaram/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-05T20:46:47Z","updated_at":"2018-11-09T15:41:33Z","closed_at":null,"author_association":"NONE","body":"@radex  Is there any difference of performance of running the application (using watermelondb) in debug mode?\r\n\r\nI'm asking because I was developing using the Chrome Debugger and everything was going well but when I've disabled it, my app started to take much time to render the items fetched from my local database - maybe it could be caused by the process of the objects?.\r\n\r\nDo you have any idea about what could be happening here? I remember that when I was using `RealmDB` I had some issues related to the data processing (it takes a bit to process the data, so all the UI is blocked until then)\r\n```js\r\nconst getCropList = (queryStr = '') => {\r\n  return async dispatch => {\r\n    dispatch(cropListActions.GET_CROP_LIST());\r\n\r\n    InteractionManager.runAfterInteractions(async () => {\r\n      try {\r\n        const db = Database.getRef();\r\n        const cropCountry = await db.collections.get('crop_country');\r\n\r\n        // BEGIN - Get highlighted crops\r\n        let cropCountryHighlighted = await cropCountry.query(Q.where('flagHighlight', 'Y')).fetch();\r\n        const highlightedCropIds = _getIdsFromCropCountry(cropCountryHighlighted);\r\n        const highlightedCrops = await db.collections\r\n          .get('crop')\r\n          .query(Q.where('remoteId', Q.oneOf(highlightedCropIds)))\r\n          .fetch();\r\n        // END - Get highlighted crops\r\n\r\n        // BEGIN - Get searchable\r\n        const searchableCrops = await db.collections\r\n          .get('crop')\r\n          .query()\r\n          .fetch();\r\n        // END - Get searchable\r\n\r\n        // BEGIN = Other\r\n        let cropCountryOther = await cropCountry\r\n          .query(Q.and(Q.where('flagHighlight', 'N'), Q.where('flagOnSearch', '0')))\r\n          .fetch();\r\n        const cropCountryOtherIds = _getIdsFromCropCountry(cropCountryOther);\r\n        const otherCrops = await db.collections\r\n          .get('crop')\r\n          .query(Q.where('remoteId', Q.oneOf(cropCountryOtherIds)))\r\n          .fetch();\r\n        // End - Other\r\n\r\n        dispatch(cropListActions.GET_CROP_LIST_SUCCESS(highlightedCrops, searchableCrops, otherCrops));\r\n      } catch (error) {\r\n        const errorMsg = 'CropListUseCase ' + error;\r\n        dispatch(cropListActions.GET_CROP_LIST_FAILURE(errorMsg));\r\n      }\r\n    });\r\n  };\r\n};\r\n```\r\n\r\n**EDIT** \r\n\r\nI just noticed that it could be caused by a circular reference on the result fetched by my query (collection, table, row, collections, etc attributes)\r\n\r\nSo I added a code in order to remove all the attributes added by the Model (watermelon) and keep only the attributes I need. It's faster than previously but it's just a workaround. Is there a way to solve it in a better way?\r\n\r\nI also had to avoid batched calls with more than 5k items, because it crashes the application. In order to solve it, I decided to batch each collection separately."},"comment":{"url":"https://api.github.com/repos/Nozbe/WatermelonDB/issues/comments/437398459","html_url":"https://github.com/Nozbe/WatermelonDB/issues/129#issuecomment-437398459","issue_url":"https://api.github.com/repos/Nozbe/WatermelonDB/issues/129","id":437398459,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzM5ODQ1OQ==","user":{"login":"radex","id":183747,"node_id":"MDQ6VXNlcjE4Mzc0Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/183747?v=4","gravatar_id":"","url":"https://api.github.com/users/radex","html_url":"https://github.com/radex","followers_url":"https://api.github.com/users/radex/followers","following_url":"https://api.github.com/users/radex/following{/other_user}","gists_url":"https://api.github.com/users/radex/gists{/gist_id}","starred_url":"https://api.github.com/users/radex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radex/subscriptions","organizations_url":"https://api.github.com/users/radex/orgs","repos_url":"https://api.github.com/users/radex/repos","events_url":"https://api.github.com/users/radex/events{/privacy}","received_events_url":"https://api.github.com/users/radex/received_events","type":"User","site_admin":false},"created_at":"2018-11-09T15:41:33Z","updated_at":"2018-11-09T15:41:33Z","author_association":"MEMBER","body":"> I'm asking because I was developing using the Chrome Debugger and everything was going well but when I've disabled it, my app started to take much time to render the items fetched from my local database - maybe it could be caused by the process of the objects?.\r\n\r\nIt _could_. Chrome has faster javascript than a RN app so if you're doing a lot of processing, you might get really slow.\r\n\r\n> I just noticed that it could be caused by a circular reference on the result fetched by my query (collection, table, row, collections, etc attributes)\r\n\r\nI don't understand.\r\n\r\n> I also had to avoid batched calls with more than 5k items, because it crashes the application. In order to solve it, I decided to batch each collection separately.\r\n\r\nare you running on Android? Have you tried adopting jsc-android?\r\n\r\n. . .\r\n\r\nHow many items are queried an fetched in this function? You're making empty queries which suggests you might be fetching and processing A LOT of data — which in RN will always be a problem"}}
{"actor":{"display_login":"radex"}}