{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/j2me.js/pulls/comments/26989745","id":26989745,"diff_hunk":"@@ -0,0 +1,48 @@\n+package benchmark;\n+\n+import com.sun.cldchi.jvm.JVM;\n+import com.sun.midp.crypto.SecureRandom;\n+import java.io.OutputStream;\n+import java.util.Random;\n+import javax.microedition.io.Connector;\n+import javax.microedition.io.file.FileConnection;\n+import org.mozilla.MemorySampler;\n+\n+public class FileConnectionBench {\n+  void runBenchmark() {\n+    try {\n+      long start, time;\n+\n+      start = JVM.monotonicTimeMillis();\n+\n+      String privateDir = System.getProperty(\"fileconn.dir.private\");\n+      Random random = new Random();\n+      String filename = new javax.bluetooth.UUID(java.lang.Math.abs(random.nextInt())).toString();\n+      FileConnection file = (FileConnection)Connector.open(privateDir + filename);\n+      System.out.println(\"Writing to file \" + privateDir + filename);\n+      file.create();\n+\n+      SecureRandom rnd = SecureRandom.getInstance(SecureRandom.ALG_SECURE_RANDOM);\n+      OutputStream out = file.openOutputStream();\n+      byte[] b = new byte[1024];\n+      for (int i = 0; i < 1000; i++) {\n+        rnd.nextBytes(b, 0, 1024);\n+        out.write(b);\n+      }\n+      out.close();\n+\n+      time = JVM.monotonicTimeMillis() - start;\n+      System.out.println(\"FileConnection.write time: \" + time);","path":"bench/FileConnectionBench.java","position":35,"original_position":35,"commit_id":"729ce2d68999f8432e6908dc5d6d9b3051f9771f","original_commit_id":"729ce2d68999f8432e6908dc5d6d9b3051f9771f","user":{"login":"marco-c","id":1616846,"avatar_url":"https://avatars.githubusercontent.com/u/1616846?v=3","gravatar_id":"","url":"https://api.github.com/users/marco-c","html_url":"https://github.com/marco-c","followers_url":"https://api.github.com/users/marco-c/followers","following_url":"https://api.github.com/users/marco-c/following{/other_user}","gists_url":"https://api.github.com/users/marco-c/gists{/gist_id}","starred_url":"https://api.github.com/users/marco-c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marco-c/subscriptions","organizations_url":"https://api.github.com/users/marco-c/orgs","repos_url":"https://api.github.com/users/marco-c/repos","events_url":"https://api.github.com/users/marco-c/events{/privacy}","received_events_url":"https://api.github.com/users/marco-c/received_events","type":"User","site_admin":false},"body":"Could you split this time in *open* and *write*?","created_at":"2015-03-23T23:04:08Z","updated_at":"2015-03-23T23:04:08Z","html_url":"https://github.com/mozilla/j2me.js/pull/1300#discussion_r26989745","pull_request_url":"https://api.github.com/repos/mozilla/j2me.js/pulls/1300","_links":{"self":{"href":"https://api.github.com/repos/mozilla/j2me.js/pulls/comments/26989745"},"html":{"href":"https://github.com/mozilla/j2me.js/pull/1300#discussion_r26989745"},"pull_request":{"href":"https://api.github.com/repos/mozilla/j2me.js/pulls/1300"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/j2me.js/pulls/1300","id":31767860,"html_url":"https://github.com/mozilla/j2me.js/pull/1300","diff_url":"https://github.com/mozilla/j2me.js/pull/1300.diff","patch_url":"https://github.com/mozilla/j2me.js/pull/1300.patch","issue_url":"https://api.github.com/repos/mozilla/j2me.js/issues/1300","number":1300,"state":"open","locked":false,"title":"benchmark FileConnection memory usage","user":{"login":"mykmelez","id":305455,"avatar_url":"https://avatars.githubusercontent.com/u/305455?v=3","gravatar_id":"","url":"https://api.github.com/users/mykmelez","html_url":"https://github.com/mykmelez","followers_url":"https://api.github.com/users/mykmelez/followers","following_url":"https://api.github.com/users/mykmelez/following{/other_user}","gists_url":"https://api.github.com/users/mykmelez/gists{/gist_id}","starred_url":"https://api.github.com/users/mykmelez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mykmelez/subscriptions","organizations_url":"https://api.github.com/users/mykmelez/orgs","repos_url":"https://api.github.com/users/mykmelez/repos","events_url":"https://api.github.com/users/mykmelez/events{/privacy}","received_events_url":"https://api.github.com/users/mykmelez/received_events","type":"User","site_admin":false},"body":"This is a very basic benchmark for measuring FileConnection memory usage. It requires you to use about:config to set the boolean preference *security.turn_off_all_security_so_that_viruses_can_take_over_this_computer* to `true`.\r\n\r\nThe benchmark simply creates a file and writes 1MB of random data to it, reporting memory usage before and after. I see either ~2MB or ~4MB increase in memory usage across the operation, although usage drops back down if I manually check again a second later.","created_at":"2015-03-23T19:54:30Z","updated_at":"2015-03-23T23:04:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d9f080b4ff1f7d6c458303c2db7a59b0ce2f59ad","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/j2me.js/pulls/1300/commits","review_comments_url":"https://api.github.com/repos/mozilla/j2me.js/pulls/1300/comments","review_comment_url":"https://api.github.com/repos/mozilla/j2me.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/j2me.js/issues/1300/comments","statuses_url":"https://api.github.com/repos/mozilla/j2me.js/statuses/729ce2d68999f8432e6908dc5d6d9b3051f9771f","head":{"label":"mykmelez:file-connection-bench","ref":"file-connection-bench","sha":"729ce2d68999f8432e6908dc5d6d9b3051f9771f","user":{"login":"mykmelez","id":305455,"avatar_url":"https://avatars.githubusercontent.com/u/305455?v=3","gravatar_id":"","url":"https://api.github.com/users/mykmelez","html_url":"https://github.com/mykmelez","followers_url":"https://api.github.com/users/mykmelez/followers","following_url":"https://api.github.com/users/mykmelez/following{/other_user}","gists_url":"https://api.github.com/users/mykmelez/gists{/gist_id}","starred_url":"https://api.github.com/users/mykmelez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mykmelez/subscriptions","organizations_url":"https://api.github.com/users/mykmelez/orgs","repos_url":"https://api.github.com/users/mykmelez/repos","events_url":"https://api.github.com/users/mykmelez/events{/privacy}","received_events_url":"https://api.github.com/users/mykmelez/received_events","type":"User","site_admin":false},"repo":{"id":22497156,"name":"j2me.js","full_name":"mykmelez/j2me.js","owner":{"login":"mykmelez","id":305455,"avatar_url":"https://avatars.githubusercontent.com/u/305455?v=3","gravatar_id":"","url":"https://api.github.com/users/mykmelez","html_url":"https://github.com/mykmelez","followers_url":"https://api.github.com/users/mykmelez/followers","following_url":"https://api.github.com/users/mykmelez/following{/other_user}","gists_url":"https://api.github.com/users/mykmelez/gists{/gist_id}","starred_url":"https://api.github.com/users/mykmelez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mykmelez/subscriptions","organizations_url":"https://api.github.com/users/mykmelez/orgs","repos_url":"https://api.github.com/users/mykmelez/repos","events_url":"https://api.github.com/users/mykmelez/events{/privacy}","received_events_url":"https://api.github.com/users/mykmelez/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mykmelez/j2me.js","description":"J2ME VM in JavaScript","fork":true,"url":"https://api.github.com/repos/mykmelez/j2me.js","forks_url":"https://api.github.com/repos/mykmelez/j2me.js/forks","keys_url":"https://api.github.com/repos/mykmelez/j2me.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mykmelez/j2me.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mykmelez/j2me.js/teams","hooks_url":"https://api.github.com/repos/mykmelez/j2me.js/hooks","issue_events_url":"https://api.github.com/repos/mykmelez/j2me.js/issues/events{/number}","events_url":"https://api.github.com/repos/mykmelez/j2me.js/events","assignees_url":"https://api.github.com/repos/mykmelez/j2me.js/assignees{/user}","branches_url":"https://api.github.com/repos/mykmelez/j2me.js/branches{/branch}","tags_url":"https://api.github.com/repos/mykmelez/j2me.js/tags","blobs_url":"https://api.github.com/repos/mykmelez/j2me.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mykmelez/j2me.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mykmelez/j2me.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/mykmelez/j2me.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mykmelez/j2me.js/statuses/{sha}","languages_url":"https://api.github.com/repos/mykmelez/j2me.js/languages","stargazers_url":"https://api.github.com/repos/mykmelez/j2me.js/stargazers","contributors_url":"https://api.github.com/repos/mykmelez/j2me.js/contributors","subscribers_url":"https://api.github.com/repos/mykmelez/j2me.js/subscribers","subscription_url":"https://api.github.com/repos/mykmelez/j2me.js/subscription","commits_url":"https://api.github.com/repos/mykmelez/j2me.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/mykmelez/j2me.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/mykmelez/j2me.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/mykmelez/j2me.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/mykmelez/j2me.js/contents/{+path}","compare_url":"https://api.github.com/repos/mykmelez/j2me.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mykmelez/j2me.js/merges","archive_url":"https://api.github.com/repos/mykmelez/j2me.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mykmelez/j2me.js/downloads","issues_url":"https://api.github.com/repos/mykmelez/j2me.js/issues{/number}","pulls_url":"https://api.github.com/repos/mykmelez/j2me.js/pulls{/number}","milestones_url":"https://api.github.com/repos/mykmelez/j2me.js/milestones{/number}","notifications_url":"https://api.github.com/repos/mykmelez/j2me.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mykmelez/j2me.js/labels{/name}","releases_url":"https://api.github.com/repos/mykmelez/j2me.js/releases{/id}","created_at":"2014-08-01T06:02:22Z","updated_at":"2015-03-23T15:11:15Z","pushed_at":"2015-03-23T20:01:13Z","git_url":"git://github.com/mykmelez/j2me.js.git","ssh_url":"git@github.com:mykmelez/j2me.js.git","clone_url":"https://github.com/mykmelez/j2me.js.git","svn_url":"https://github.com/mykmelez/j2me.js","homepage":null,"size":21032,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"58d6c5288b2d279a0aa52b913575b9c549d02608","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":21724513,"name":"j2me.js","full_name":"mozilla/j2me.js","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/j2me.js","description":"J2ME VM in JavaScript","fork":false,"url":"https://api.github.com/repos/mozilla/j2me.js","forks_url":"https://api.github.com/repos/mozilla/j2me.js/forks","keys_url":"https://api.github.com/repos/mozilla/j2me.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/j2me.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/j2me.js/teams","hooks_url":"https://api.github.com/repos/mozilla/j2me.js/hooks","issue_events_url":"https://api.github.com/repos/mozilla/j2me.js/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/j2me.js/events","assignees_url":"https://api.github.com/repos/mozilla/j2me.js/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/j2me.js/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/j2me.js/tags","blobs_url":"https://api.github.com/repos/mozilla/j2me.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/j2me.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/j2me.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/j2me.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/j2me.js/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/j2me.js/languages","stargazers_url":"https://api.github.com/repos/mozilla/j2me.js/stargazers","contributors_url":"https://api.github.com/repos/mozilla/j2me.js/contributors","subscribers_url":"https://api.github.com/repos/mozilla/j2me.js/subscribers","subscription_url":"https://api.github.com/repos/mozilla/j2me.js/subscription","commits_url":"https://api.github.com/repos/mozilla/j2me.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/j2me.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/j2me.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/j2me.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/j2me.js/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/j2me.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/j2me.js/merges","archive_url":"https://api.github.com/repos/mozilla/j2me.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/j2me.js/downloads","issues_url":"https://api.github.com/repos/mozilla/j2me.js/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/j2me.js/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/j2me.js/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/j2me.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/j2me.js/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/j2me.js/releases{/id}","created_at":"2014-07-11T06:23:27Z","updated_at":"2015-03-23T11:18:43Z","pushed_at":"2015-03-23T22:56:44Z","git_url":"git://github.com/mozilla/j2me.js.git","ssh_url":"git@github.com:mozilla/j2me.js.git","clone_url":"https://github.com/mozilla/j2me.js.git","svn_url":"https://github.com/mozilla/j2me.js","homepage":null,"size":27670,"stargazers_count":65,"watchers_count":65,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":193,"forks":18,"open_issues":193,"watchers":65,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/j2me.js/pulls/1300"},"html":{"href":"https://github.com/mozilla/j2me.js/pull/1300"},"issue":{"href":"https://api.github.com/repos/mozilla/j2me.js/issues/1300"},"comments":{"href":"https://api.github.com/repos/mozilla/j2me.js/issues/1300/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/j2me.js/pulls/1300/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/j2me.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/j2me.js/pulls/1300/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/j2me.js/statuses/729ce2d68999f8432e6908dc5d6d9b3051f9771f"}}}}