{"action":"created","issue":{"url":"https://api.github.com/repos/ericwlange/AndroidJSCore/issues/39","repository_url":"https://api.github.com/repos/ericwlange/AndroidJSCore","labels_url":"https://api.github.com/repos/ericwlange/AndroidJSCore/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/ericwlange/AndroidJSCore/issues/39/comments","events_url":"https://api.github.com/repos/ericwlange/AndroidJSCore/issues/39/events","html_url":"https://github.com/ericwlange/AndroidJSCore/issues/39","id":175168704,"number":39,"title":"Call Java functions 10000 times from JS","user":{"login":"LiuHongtao","id":4995581,"avatar_url":"https://avatars.githubusercontent.com/u/4995581?v=3","gravatar_id":"","url":"https://api.github.com/users/LiuHongtao","html_url":"https://github.com/LiuHongtao","followers_url":"https://api.github.com/users/LiuHongtao/followers","following_url":"https://api.github.com/users/LiuHongtao/following{/other_user}","gists_url":"https://api.github.com/users/LiuHongtao/gists{/gist_id}","starred_url":"https://api.github.com/users/LiuHongtao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LiuHongtao/subscriptions","organizations_url":"https://api.github.com/users/LiuHongtao/orgs","repos_url":"https://api.github.com/users/LiuHongtao/repos","events_url":"https://api.github.com/users/LiuHongtao/events{/privacy}","received_events_url":"https://api.github.com/users/LiuHongtao/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-06T06:20:47Z","updated_at":"2016-09-13T08:26:55Z","closed_at":null,"body":"Hi, thanks for your work, it helps me a lot.\r\n\r\nAs the code shows, `func()` is called from JS for 10000 times. It spends about 380ms on Genymotion and about 1200ms on my phone, which seems a little bit long. Did i do something wrong? Does time are spend on java reflection?\r\n\r\nAnother Problem: If `func()` is called 50000 times or a lager number, the first start of TestActivity is ok, but the second start will make the app busy and ANR at `new JSContext()`.\r\n\r\nJS code:\r\n\r\n    for (var i = 0; i < 10000; i++) {\r\n        func(i)\r\n    }\r\n\r\nJava code in TestActivity.onCreate:\r\n\r\n    mJsContext = new JSContext();\r\n    mJsContext.property(\"func\", new JSFunction(mJsContext, \"func\") {\r\n        public void func(int i) {\r\n        }\r\n    });\r\n\r\n    long start = System.currentTimeMillis();\r\n    mJsContext.evaluateScript(js);\r\n    long end = System.currentTimeMillis();\r\n    long time = end - start;\r\n"},"comment":{"url":"https://api.github.com/repos/ericwlange/AndroidJSCore/issues/comments/246611364","html_url":"https://github.com/ericwlange/AndroidJSCore/issues/39#issuecomment-246611364","issue_url":"https://api.github.com/repos/ericwlange/AndroidJSCore/issues/39","id":246611364,"user":{"login":"ericwlange","id":1191524,"avatar_url":"https://avatars.githubusercontent.com/u/1191524?v=3","gravatar_id":"","url":"https://api.github.com/users/ericwlange","html_url":"https://github.com/ericwlange","followers_url":"https://api.github.com/users/ericwlange/followers","following_url":"https://api.github.com/users/ericwlange/following{/other_user}","gists_url":"https://api.github.com/users/ericwlange/gists{/gist_id}","starred_url":"https://api.github.com/users/ericwlange/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericwlange/subscriptions","organizations_url":"https://api.github.com/users/ericwlange/orgs","repos_url":"https://api.github.com/users/ericwlange/repos","events_url":"https://api.github.com/users/ericwlange/events{/privacy}","received_events_url":"https://api.github.com/users/ericwlange/received_events","type":"User","site_admin":false},"created_at":"2016-09-13T08:26:55Z","updated_at":"2016-09-13T08:26:55Z","body":"That example is just showing a case where `number` is private, but `name` is public.  In that case, javascript can modify public values but not private ones.  It's actually not a very useful example.  I was just copying what Owen had done verbatim."}}
{"actor":{"display_login":"ericwlange"}}