Skip to content

Commit d4a9d03

Browse files
Update performance vignette
1 parent d6ca819 commit d4a9d03

1 file changed

Lines changed: 17 additions & 13 deletions

File tree

vignettes/performance.Rmd

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,26 +59,30 @@ cg <- caugi::as_caugi(ig, class = "DAG")
5959
```
6060
`
6161
```{r benchmark-igraph-query}
62-
mb_igraph <- microbenchmark(
62+
microbenchmark(
63+
# igraph
6364
igraph_neighbors = igraph::neighbors(ig, 50),
6465
igraph_parents = igraph::neighbors(ig, 50, mode = "in"),
6566
igraph_children = igraph::neighbors(ig, 50, mode = "out"),
66-
times = 1000
67-
)
6867
69-
mb_caugi <- microbenchmark(
70-
caugi_neighbors = caugi:::neighbors_of_ptr(cg@ptr, 50),
71-
caugi_parents = caugi:::parents_of_ptr(cg@ptr, 50),
72-
caugi_children = caugi:::children_of_ptr(cg@ptr, 50),
73-
times = 1000
68+
# using index (fastest R side option)
69+
caugi_neighbors_index = caugi::neighbors(cg, index = 50),
70+
caugi_parents_index = caugi::parents(cg, index = 50),
71+
caugi_children_index = caugi::children(cg, index = 50),
72+
73+
# using node name (same as index here, but slower)
74+
caugi_neighbors_parsed = caugi::neighbors(cg, "50"),
75+
caugi_parents_parsed = caugi::parents(cg, "50"),
76+
caugi_children_parsed = caugi::children(cg, "50"),
77+
78+
# using Rust backend directly (fastest possible, 0 indexed, less safe)
79+
caugi_neighbors_rust = caugi:::neighbors_of_ptr(cg@ptr, 49L),
80+
caugi_parents_rust = caugi:::parents_of_ptr(cg@ptr, 49L),
81+
caugi_children_rust = caugi:::children_of_ptr(cg@ptr, 49L),
82+
times = 10000
7483
)
7584
```
7685

77-
```{r benchmark-results}
78-
print(mb_igraph)
79-
print(mb_caugi)
80-
```
81-
8286
### Session info
8387

8488
```{r session-info}

0 commit comments

Comments
 (0)