-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathspiderbar_and_futures.r
112 lines (86 loc) · 1.8 KB
/
spiderbar_and_futures.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
library(spiderbar)
library(robotstxt)
library(future)
# get file with urls
urls_fname <- system.file("urls.txt", package="robotstxt")
readLines(urls_fname)[1:3]
urls <- readLines(urls_fname)[-c(1:5)][1:100]
paths <- urls
domain <- robotstxt:::guess_domain(paths)
# tests for sequential
plan("sequential")
with_fetch_seq <-
system.time(
paths_allowed(
urls,
warn = FALSE,
force = TRUE,
use_futures = FALSE,
check_method = "robotstxt"
)
)
wo_fetch_seq_robotstxt <-
system.time(
paths_allowed(
urls,
warn = FALSE,
force = FALSE,
use_futures = FALSE,
check_method = "robotstxt"
)
)
wo_fetch_seq_spiderbar <-
system.time(
paths_allowed(
urls,
warn = FALSE,
force = FALSE,
use_futures = FALSE,
check_method = "spiderbar"
)
)
# tests for parallel
plan("multisession")
with_fetch_parallel <-
system.time(
paths_allowed(
urls,
warn = FALSE,
force = TRUE,
use_futures = TRUE,
check_method = "robotstxt"
)
)
wo_fetch_parallel_robotstxt <-
system.time(
paths_allowed(
urls,
warn = FALSE,
force = FALSE,
use_futures = TRUE,
check_method = "robotstxt"
)
)
wo_fetch_parallel_spiderbar <-
system.time(
paths_allowed(
urls,
warn = FALSE,
force = FALSE,
use_futures = TRUE,
check_method = "spiderbar"
)
)
# results
with_fetch_seq
wo_fetch_seq_robotstxt
wo_fetch_seq_spiderbar
with_fetch_parallel
wo_fetch_parallel_robotstxt
wo_fetch_parallel_spiderbar
with_fetch_seq
with_fetch_parallel
wo_fetch_seq_robotstxt
wo_fetch_parallel_robotstxt
wo_fetch_seq_spiderbar
wo_fetch_parallel_spiderbar