{"action":"created","comment":{"url":"https://api.github.com/repos/twitter/GraphJet/pulls/comments/87680647","pull_request_review_id":8287431,"id":87680647,"diff_hunk":"@@ -0,0 +1,201 @@\n+/**\n+ * Copyright 2016 Twitter. All rights reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *    http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package com.twitter.graphjet.demo;\n+\n+import com.twitter.graphjet.algorithms.PageRank;\n+import com.twitter.graphjet.bipartite.segment.IdentityEdgeTypeMask;\n+import com.twitter.graphjet.directed.OutIndexedPowerLawMultiSegmentDirectedGraph;\n+import com.twitter.graphjet.stats.NullStatsReceiver;\n+import it.unimi.dsi.fastutil.longs.LongOpenHashSet;\n+import org.kohsuke.args4j.CmdLineException;\n+import org.kohsuke.args4j.CmdLineParser;\n+import org.kohsuke.args4j.Option;\n+import org.kohsuke.args4j.ParserProperties;\n+\n+import java.io.BufferedReader;\n+import java.io.InputStream;\n+import java.io.InputStreamReader;\n+import java.nio.file.Files;\n+import java.nio.file.Paths;\n+import java.util.concurrent.atomic.AtomicLong;\n+import java.util.zip.GZIPInputStream;\n+\n+/**\n+ * Simple benchmark program that loads a graph and runs PageRank over it.\n+ */\n+public class PageRankGraphJetDemo {\n+  private static class PageRankGraphJetDemoArgs {\n+    @Option(name = \"-inputFile\", metaVar = \"[value]\",\n+        usage = \"input data\", required = true)\n+    String inputFile;\n+\n+    @Option(name = \"-maxSegments\", metaVar = \"[value]\",\n+        usage = \"maximum number of segments\")\n+    int maxSegments = 20;\n+\n+    @Option(name = \"-maxEdgesPerSegment\", metaVar = \"[value]\",\n+        usage = \"maximum number of edges in each segment\")\n+    int maxEdgesPerSegment = 10000000;\n+\n+    @Option(name = \"-numNodes\", metaVar = \"[value]\",\n+        usage = \"expected number of nodes in each segment\")\n+    int leftSize = 1000000;\n+\n+    @Option(name = \"-expectedMaxDegree\", metaVar = \"[value]\",\n+        usage = \"expected maximum degree\")\n+    int leftDegree = 5000000;\n+\n+    @Option(name = \"-powerLawExponent\", metaVar = \"[value]\",\n+        usage = \"power Law exponent\")\n+    float leftPowerLawExponent = 2.0f;\n+\n+    @Option(name = \"-dumpTopK\", metaVar = \"[value]\",\n+        usage = \"dump top k nodes to stdout\")\n+    int k = 0;\n+\n+    @Option(name = \"-iterations\", metaVar = \"[value]\",\n+        usage = \"number of iterations to run per trial\")\n+    int iterations = 10;\n+\n+    @Option(name = \"-trials\", metaVar = \"[value]\",\n+        usage = \"number of trials to run\")\n+    int trials = 10;\n+  }\n+\n+  public static void main(String[] argv) throws Exception {\n+    final PageRankGraphJetDemoArgs args = new PageRankGraphJetDemoArgs();\n+    CmdLineParser parser = new CmdLineParser(args, ParserProperties.defaults().withUsageWidth(90));\n+\n+    try {\n+      parser.parseArgument(argv);\n+    } catch (CmdLineException e) {\n+      System.err.println(e.getMessage());\n+      parser.printUsage(System.err);\n+      return;\n+    }\n+\n+    String graphPath = args.inputFile;\n+\n+    OutIndexedPowerLawMultiSegmentDirectedGraph graph =\n+        new OutIndexedPowerLawMultiSegmentDirectedGraph(args.maxSegments, args.maxEdgesPerSegment,\n+            args.leftSize, args.leftDegree, args.leftPowerLawExponent,\n+            new IdentityEdgeTypeMask(),\n+            new NullStatsReceiver());\n+\n+    final LongOpenHashSet nodes = new LongOpenHashSet();   // Note, *not* thread safe.\n+    final AtomicLong fileEdgeCounter = new AtomicLong();\n+    final AtomicLong maxNodeId = new AtomicLong();\n+\n+    System.out.println(\"Loading graph from file...\");\n+    long loadStart = System.currentTimeMillis();\n+\n+    Files.walk(Paths.get(graphPath)).forEach(filePath -> {\n+      if (Files.isRegularFile(filePath)) {\n+        try {\n+          InputStream inputStream = Files.newInputStream(filePath);\n+          GZIPInputStream gzip = new GZIPInputStream(inputStream);\n+          BufferedReader br = new BufferedReader(new InputStreamReader(gzip));\n+          String line;\n+          while((line = br.readLine()) != null) {\n+            if (line.startsWith(\"#\")) continue;\n+\n+            String[] tokens = line.split(\"\\\\s+\");\n+            if (tokens.length > 1) {\n+              final long from = Long.parseLong(tokens[0]);\n+              final long to = Long.parseLong(tokens[1]);\n+              graph.addEdge(from, to, (byte) 1);","path":"graphjet-demo/src/main/java/com/twitter/graphjet/demo/PageRankGraphJetDemo.java","position":120,"original_position":120,"commit_id":"9c470e0b0e28cd0f6fc9922aec2ca365d6380b3e","original_commit_id":"9c470e0b0e28cd0f6fc9922aec2ca365d6380b3e","user":{"login":"aneeshs","id":1533926,"avatar_url":"https://avatars.githubusercontent.com/u/1533926?v=3","gravatar_id":"","url":"https://api.github.com/users/aneeshs","html_url":"https://github.com/aneeshs","followers_url":"https://api.github.com/users/aneeshs/followers","following_url":"https://api.github.com/users/aneeshs/following{/other_user}","gists_url":"https://api.github.com/users/aneeshs/gists{/gist_id}","starred_url":"https://api.github.com/users/aneeshs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aneeshs/subscriptions","organizations_url":"https://api.github.com/users/aneeshs/orgs","repos_url":"https://api.github.com/users/aneeshs/repos","events_url":"https://api.github.com/users/aneeshs/events{/privacy}","received_events_url":"https://api.github.com/users/aneeshs/received_events","type":"User","site_admin":false},"body":"can store a reuse a \"(byte) 1\" variable","created_at":"2016-11-12T00:43:36Z","updated_at":"2016-11-12T00:43:36Z","html_url":"https://github.com/twitter/GraphJet/pull/44#discussion_r87680647","pull_request_url":"https://api.github.com/repos/twitter/GraphJet/pulls/44","_links":{"self":{"href":"https://api.github.com/repos/twitter/GraphJet/pulls/comments/87680647"},"html":{"href":"https://github.com/twitter/GraphJet/pull/44#discussion_r87680647"},"pull_request":{"href":"https://api.github.com/repos/twitter/GraphJet/pulls/44"}}},"pull_request":{"url":"https://api.github.com/repos/twitter/GraphJet/pulls/44","id":91317028,"html_url":"https://github.com/twitter/GraphJet/pull/44","diff_url":"https://github.com/twitter/GraphJet/pull/44.diff","patch_url":"https://github.com/twitter/GraphJet/pull/44.patch","issue_url":"https://api.github.com/repos/twitter/GraphJet/issues/44","number":44,"state":"open","locked":false,"title":"PageRank performance benchmark comparing Cassovary and GraphJet","user":{"login":"lintool","id":313837,"avatar_url":"https://avatars.githubusercontent.com/u/313837?v=3","gravatar_id":"","url":"https://api.github.com/users/lintool","html_url":"https://github.com/lintool","followers_url":"https://api.github.com/users/lintool/followers","following_url":"https://api.github.com/users/lintool/following{/other_user}","gists_url":"https://api.github.com/users/lintool/gists{/gist_id}","starred_url":"https://api.github.com/users/lintool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lintool/subscriptions","organizations_url":"https://api.github.com/users/lintool/orgs","repos_url":"https://api.github.com/users/lintool/repos","events_url":"https://api.github.com/users/lintool/events{/privacy}","received_events_url":"https://api.github.com/users/lintool/received_events","type":"User","site_admin":false},"body":"Benchmarks PageRank on a GraphJet graph vs. PageRank on a Cassovary graph.\n","created_at":"2016-10-28T03:29:25Z","updated_at":"2016-11-12T00:43:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1995c3801a8afa584d6d295db069e7650ab89a52","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/twitter/GraphJet/pulls/44/commits","review_comments_url":"https://api.github.com/repos/twitter/GraphJet/pulls/44/comments","review_comment_url":"https://api.github.com/repos/twitter/GraphJet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/twitter/GraphJet/issues/44/comments","statuses_url":"https://api.github.com/repos/twitter/GraphJet/statuses/9c470e0b0e28cd0f6fc9922aec2ca365d6380b3e","head":{"label":"twitter:lintool/pagerank-perf","ref":"lintool/pagerank-perf","sha":"9c470e0b0e28cd0f6fc9922aec2ca365d6380b3e","user":{"login":"twitter","id":50278,"avatar_url":"https://avatars.githubusercontent.com/u/50278?v=3","gravatar_id":"","url":"https://api.github.com/users/twitter","html_url":"https://github.com/twitter","followers_url":"https://api.github.com/users/twitter/followers","following_url":"https://api.github.com/users/twitter/following{/other_user}","gists_url":"https://api.github.com/users/twitter/gists{/gist_id}","starred_url":"https://api.github.com/users/twitter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twitter/subscriptions","organizations_url":"https://api.github.com/users/twitter/orgs","repos_url":"https://api.github.com/users/twitter/repos","events_url":"https://api.github.com/users/twitter/events{/privacy}","received_events_url":"https://api.github.com/users/twitter/received_events","type":"Organization","site_admin":false},"repo":{"id":53354223,"name":"GraphJet","full_name":"twitter/GraphJet","owner":{"login":"twitter","id":50278,"avatar_url":"https://avatars.githubusercontent.com/u/50278?v=3","gravatar_id":"","url":"https://api.github.com/users/twitter","html_url":"https://github.com/twitter","followers_url":"https://api.github.com/users/twitter/followers","following_url":"https://api.github.com/users/twitter/following{/other_user}","gists_url":"https://api.github.com/users/twitter/gists{/gist_id}","starred_url":"https://api.github.com/users/twitter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twitter/subscriptions","organizations_url":"https://api.github.com/users/twitter/orgs","repos_url":"https://api.github.com/users/twitter/repos","events_url":"https://api.github.com/users/twitter/events{/privacy}","received_events_url":"https://api.github.com/users/twitter/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/twitter/GraphJet","description":"GraphJet is a real-time graph processing library.","fork":false,"url":"https://api.github.com/repos/twitter/GraphJet","forks_url":"https://api.github.com/repos/twitter/GraphJet/forks","keys_url":"https://api.github.com/repos/twitter/GraphJet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/twitter/GraphJet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/twitter/GraphJet/teams","hooks_url":"https://api.github.com/repos/twitter/GraphJet/hooks","issue_events_url":"https://api.github.com/repos/twitter/GraphJet/issues/events{/number}","events_url":"https://api.github.com/repos/twitter/GraphJet/events","assignees_url":"https://api.github.com/repos/twitter/GraphJet/assignees{/user}","branches_url":"https://api.github.com/repos/twitter/GraphJet/branches{/branch}","tags_url":"https://api.github.com/repos/twitter/GraphJet/tags","blobs_url":"https://api.github.com/repos/twitter/GraphJet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/twitter/GraphJet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/twitter/GraphJet/git/refs{/sha}","trees_url":"https://api.github.com/repos/twitter/GraphJet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/twitter/GraphJet/statuses/{sha}","languages_url":"https://api.github.com/repos/twitter/GraphJet/languages","stargazers_url":"https://api.github.com/repos/twitter/GraphJet/stargazers","contributors_url":"https://api.github.com/repos/twitter/GraphJet/contributors","subscribers_url":"https://api.github.com/repos/twitter/GraphJet/subscribers","subscription_url":"https://api.github.com/repos/twitter/GraphJet/subscription","commits_url":"https://api.github.com/repos/twitter/GraphJet/commits{/sha}","git_commits_url":"https://api.github.com/repos/twitter/GraphJet/git/commits{/sha}","comments_url":"https://api.github.com/repos/twitter/GraphJet/comments{/number}","issue_comment_url":"https://api.github.com/repos/twitter/GraphJet/issues/comments{/number}","contents_url":"https://api.github.com/repos/twitter/GraphJet/contents/{+path}","compare_url":"https://api.github.com/repos/twitter/GraphJet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/twitter/GraphJet/merges","archive_url":"https://api.github.com/repos/twitter/GraphJet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/twitter/GraphJet/downloads","issues_url":"https://api.github.com/repos/twitter/GraphJet/issues{/number}","pulls_url":"https://api.github.com/repos/twitter/GraphJet/pulls{/number}","milestones_url":"https://api.github.com/repos/twitter/GraphJet/milestones{/number}","notifications_url":"https://api.github.com/repos/twitter/GraphJet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/twitter/GraphJet/labels{/name}","releases_url":"https://api.github.com/repos/twitter/GraphJet/releases{/id}","deployments_url":"https://api.github.com/repos/twitter/GraphJet/deployments","created_at":"2016-03-07T19:51:18Z","updated_at":"2016-11-11T13:56:24Z","pushed_at":"2016-11-09T22:26:38Z","git_url":"git://github.com/twitter/GraphJet.git","ssh_url":"git@github.com:twitter/GraphJet.git","clone_url":"https://github.com/twitter/GraphJet.git","svn_url":"https://github.com/twitter/GraphJet","homepage":"","size":902,"stargazers_count":328,"watchers_count":328,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":28,"mirror_url":null,"open_issues_count":9,"forks":28,"open_issues":9,"watchers":328,"default_branch":"master"}},"base":{"label":"twitter:master","ref":"master","sha":"daa3e486d422999d86c0607fed3d12c6d2dfd37d","user":{"login":"twitter","id":50278,"avatar_url":"https://avatars.githubusercontent.com/u/50278?v=3","gravatar_id":"","url":"https://api.github.com/users/twitter","html_url":"https://github.com/twitter","followers_url":"https://api.github.com/users/twitter/followers","following_url":"https://api.github.com/users/twitter/following{/other_user}","gists_url":"https://api.github.com/users/twitter/gists{/gist_id}","starred_url":"https://api.github.com/users/twitter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twitter/subscriptions","organizations_url":"https://api.github.com/users/twitter/orgs","repos_url":"https://api.github.com/users/twitter/repos","events_url":"https://api.github.com/users/twitter/events{/privacy}","received_events_url":"https://api.github.com/users/twitter/received_events","type":"Organization","site_admin":false},"repo":{"id":53354223,"name":"GraphJet","full_name":"twitter/GraphJet","owner":{"login":"twitter","id":50278,"avatar_url":"https://avatars.githubusercontent.com/u/50278?v=3","gravatar_id":"","url":"https://api.github.com/users/twitter","html_url":"https://github.com/twitter","followers_url":"https://api.github.com/users/twitter/followers","following_url":"https://api.github.com/users/twitter/following{/other_user}","gists_url":"https://api.github.com/users/twitter/gists{/gist_id}","starred_url":"https://api.github.com/users/twitter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twitter/subscriptions","organizations_url":"https://api.github.com/users/twitter/orgs","repos_url":"https://api.github.com/users/twitter/repos","events_url":"https://api.github.com/users/twitter/events{/privacy}","received_events_url":"https://api.github.com/users/twitter/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/twitter/GraphJet","description":"GraphJet is a real-time graph processing library.","fork":false,"url":"https://api.github.com/repos/twitter/GraphJet","forks_url":"https://api.github.com/repos/twitter/GraphJet/forks","keys_url":"https://api.github.com/repos/twitter/GraphJet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/twitter/GraphJet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/twitter/GraphJet/teams","hooks_url":"https://api.github.com/repos/twitter/GraphJet/hooks","issue_events_url":"https://api.github.com/repos/twitter/GraphJet/issues/events{/number}","events_url":"https://api.github.com/repos/twitter/GraphJet/events","assignees_url":"https://api.github.com/repos/twitter/GraphJet/assignees{/user}","branches_url":"https://api.github.com/repos/twitter/GraphJet/branches{/branch}","tags_url":"https://api.github.com/repos/twitter/GraphJet/tags","blobs_url":"https://api.github.com/repos/twitter/GraphJet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/twitter/GraphJet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/twitter/GraphJet/git/refs{/sha}","trees_url":"https://api.github.com/repos/twitter/GraphJet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/twitter/GraphJet/statuses/{sha}","languages_url":"https://api.github.com/repos/twitter/GraphJet/languages","stargazers_url":"https://api.github.com/repos/twitter/GraphJet/stargazers","contributors_url":"https://api.github.com/repos/twitter/GraphJet/contributors","subscribers_url":"https://api.github.com/repos/twitter/GraphJet/subscribers","subscription_url":"https://api.github.com/repos/twitter/GraphJet/subscription","commits_url":"https://api.github.com/repos/twitter/GraphJet/commits{/sha}","git_commits_url":"https://api.github.com/repos/twitter/GraphJet/git/commits{/sha}","comments_url":"https://api.github.com/repos/twitter/GraphJet/comments{/number}","issue_comment_url":"https://api.github.com/repos/twitter/GraphJet/issues/comments{/number}","contents_url":"https://api.github.com/repos/twitter/GraphJet/contents/{+path}","compare_url":"https://api.github.com/repos/twitter/GraphJet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/twitter/GraphJet/merges","archive_url":"https://api.github.com/repos/twitter/GraphJet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/twitter/GraphJet/downloads","issues_url":"https://api.github.com/repos/twitter/GraphJet/issues{/number}","pulls_url":"https://api.github.com/repos/twitter/GraphJet/pulls{/number}","milestones_url":"https://api.github.com/repos/twitter/GraphJet/milestones{/number}","notifications_url":"https://api.github.com/repos/twitter/GraphJet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/twitter/GraphJet/labels{/name}","releases_url":"https://api.github.com/repos/twitter/GraphJet/releases{/id}","deployments_url":"https://api.github.com/repos/twitter/GraphJet/deployments","created_at":"2016-03-07T19:51:18Z","updated_at":"2016-11-11T13:56:24Z","pushed_at":"2016-11-09T22:26:38Z","git_url":"git://github.com/twitter/GraphJet.git","ssh_url":"git@github.com:twitter/GraphJet.git","clone_url":"https://github.com/twitter/GraphJet.git","svn_url":"https://github.com/twitter/GraphJet","homepage":"","size":902,"stargazers_count":328,"watchers_count":328,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":28,"mirror_url":null,"open_issues_count":9,"forks":28,"open_issues":9,"watchers":328,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/twitter/GraphJet/pulls/44"},"html":{"href":"https://github.com/twitter/GraphJet/pull/44"},"issue":{"href":"https://api.github.com/repos/twitter/GraphJet/issues/44"},"comments":{"href":"https://api.github.com/repos/twitter/GraphJet/issues/44/comments"},"review_comments":{"href":"https://api.github.com/repos/twitter/GraphJet/pulls/44/comments"},"review_comment":{"href":"https://api.github.com/repos/twitter/GraphJet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/twitter/GraphJet/pulls/44/commits"},"statuses":{"href":"https://api.github.com/repos/twitter/GraphJet/statuses/9c470e0b0e28cd0f6fc9922aec2ca365d6380b3e"}}}}
{"actor":{"display_login":"aneeshs"}}