{"action":"created","issue":{"url":"https://api.github.com/repos/vanadium/issues/issues/772","labels_url":"https://api.github.com/repos/vanadium/issues/issues/772/labels{/name}","comments_url":"https://api.github.com/repos/vanadium/issues/issues/772/comments","events_url":"https://api.github.com/repos/vanadium/issues/issues/772/events","html_url":"https://github.com/vanadium/issues/issues/772","id":110907885,"number":772,"title":"400ms to fetch 80KB from syncbase on Nexus 6","user":{"login":"kenashcraft","id":9617941,"avatar_url":"https://avatars.githubusercontent.com/u/9617941?v=3","gravatar_id":"","url":"https://api.github.com/users/kenashcraft","html_url":"https://github.com/kenashcraft","followers_url":"https://api.github.com/users/kenashcraft/followers","following_url":"https://api.github.com/users/kenashcraft/following{/other_user}","gists_url":"https://api.github.com/users/kenashcraft/gists{/gist_id}","starred_url":"https://api.github.com/users/kenashcraft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kenashcraft/subscriptions","organizations_url":"https://api.github.com/users/kenashcraft/orgs","repos_url":"https://api.github.com/users/kenashcraft/repos","events_url":"https://api.github.com/users/kenashcraft/events{/privacy}","received_events_url":"https://api.github.com/users/kenashcraft/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"mattr-google","id":9452107,"avatar_url":"https://avatars.githubusercontent.com/u/9452107?v=3","gravatar_id":"","url":"https://api.github.com/users/mattr-google","html_url":"https://github.com/mattr-google","followers_url":"https://api.github.com/users/mattr-google/followers","following_url":"https://api.github.com/users/mattr-google/following{/other_user}","gists_url":"https://api.github.com/users/mattr-google/gists{/gist_id}","starred_url":"https://api.github.com/users/mattr-google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattr-google/subscriptions","organizations_url":"https://api.github.com/users/mattr-google/orgs","repos_url":"https://api.github.com/users/mattr-google/repos","events_url":"https://api.github.com/users/mattr-google/events{/privacy}","received_events_url":"https://api.github.com/users/mattr-google/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-10-12T04:37:07Z","updated_at":"2015-10-12T16:25:37Z","closed_at":null,"body":"I'm storing 80KB images in syncbase.  It takes about 400ms to fetch them (with a query, if that matters) on a Nexus 6.  This is a representative image:\r\n![slide1_thumb](https://cloud.githubusercontent.com/assets/9617941/10421472/df766d8c-705d-11e5-8778-bc50f803f4ab.png)\r\n\r\nThis is really painful!  I'm going to further compress my images, but I can only do so much before they look bad.\r\n\r\nHere's my code:\r\n\r\n        private void fetchData() {\r\n            //Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);\r\n\r\n            try {\r\n                BatchDatabase batch = mDB.beginBatch(mVContext, null);\r\n                Table table = batch.getTable(NOTES_TABLE);\r\n\r\n                String query = \"SELECT k, v FROM Decks WHERE Type(v) LIKE \\\"%Slide\\\" \" +\r\n                        \"AND k LIKE \\\"\" + NamingUtil.join(mDeckId, \"slides\") + \"%\\\"\";\r\n                ResultStream stream = batch.exec(mVContext, query);\r\n                // TODO(kash): Abort execution if interrupted.  Perhaps we should derive\r\n                // a new VContext so it can be cancelled.\r\n                for (List<VdlAny> row : stream) {\r\n                    if (row.size() != 2) {\r\n                        throw new VException(\"Wrong number of columns: \" + row.size());\r\n                    }\r\n                    String key = (String) row.get(0).getElem();\r\n                    Log.i(TAG, \"Fetched slide \" + key);\r\n                    io.v.android.apps.syncslides.Slide slide =\r\n                            (io.v.android.apps.syncslides.Slide) row.get(1).getElem();\r\n                    Note note = (Note) table.get(mVContext, key, Note.class);\r\n                    final SyncbaseSlide newSlide = new SyncbaseSlide(\r\n                            key, slide.getThumbnail(), note.getText());\r\n                    mHandler.post(new Runnable() {\r\n                        @Override\r\n                        public void run() {\r\n                            mSlides.add(newSlide);\r\n                            mListener.notifyItemInserted(mSlides.size() - 1);\r\n                        }\r\n                    });\r\n                }\r\n            } catch (VException e) {\r\n                Log.e(TAG, e.toString());\r\n            }\r\n        }\r\n\r\n@rogulenko, can you work with Matt to create a microbenchmark?  Perhaps start with Go with a Put/Get of the image.  If that is ok, move to vanilla Java.  If that is ok, move to Android.\r\n\r\n@suharshs @asadovsky "},"comment":{"url":"https://api.github.com/repos/vanadium/issues/issues/comments/147452185","html_url":"https://github.com/vanadium/issues/issues/772#issuecomment-147452185","issue_url":"https://api.github.com/repos/vanadium/issues/issues/772","id":147452185,"user":{"login":"kenashcraft","id":9617941,"avatar_url":"https://avatars.githubusercontent.com/u/9617941?v=3","gravatar_id":"","url":"https://api.github.com/users/kenashcraft","html_url":"https://github.com/kenashcraft","followers_url":"https://api.github.com/users/kenashcraft/followers","following_url":"https://api.github.com/users/kenashcraft/following{/other_user}","gists_url":"https://api.github.com/users/kenashcraft/gists{/gist_id}","starred_url":"https://api.github.com/users/kenashcraft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kenashcraft/subscriptions","organizations_url":"https://api.github.com/users/kenashcraft/orgs","repos_url":"https://api.github.com/users/kenashcraft/repos","events_url":"https://api.github.com/users/kenashcraft/events{/privacy}","received_events_url":"https://api.github.com/users/kenashcraft/received_events","type":"User","site_admin":false},"created_at":"2015-10-12T16:25:37Z","updated_at":"2015-10-12T16:25:37Z","body":"@spetrovic77 "}}