Limit Cred Explorer to display 100 entries (#342)

Right now, the cred explorer attempts to display every node in the
graph. As graphs easily grow to O(100k) nodes, this is not kind to the
browser.

This commit limits display to the first 100 entries. Since they are
sorted by percieved importance, and it's easy to filter by type (e.g. to
find all users), this limitation is fine in practice.

Test plan:
Run the cred explorer on a larger repo and observe that the performance
is enormously improved. No unit tests added, as the cred explorer is a
prototype which is basically untested (#269)
This commit is contained in:
Dandelion Mané 2018-06-05 10:36:47 -07:00 committed by GitHub
parent 910e4fc831
commit 540bd860c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -13,6 +13,8 @@ import {nodeDescription as githubNodeDescription} from "../../plugins/github/ren
import {nodeDescription as gitNodeDescription} from "../../plugins/git/render";
import type {PagerankResult} from "./basicPagerank";
const MAX_TABLE_ENTRIES = 100;
type Props = {
pagerankResult: ?PagerankResult,
graph: ?Graph,
@ -220,6 +222,7 @@ class RecursiveTables extends React.Component<RecursiveTablesProps> {
const y = pagerankResult.get(b).probability;
return y - x;
})
.slice(0, MAX_TABLE_ENTRIES)
.map((address) => (
<RecursiveTable
depth={depth}