-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbenchmark.log
104 lines (82 loc) · 3.18 KB
/
benchmark.log
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
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
name: <unnamed>
log: D:\repos\stata-rcallcountrycode\benchmark\benchmark.log
log type: text
opened on: 18 Feb 2019, 21:56:53
.
. which kountry
c:\ado\plus\k\kountry.ado
*! version 2.1.6 12aug2013
.
. * list of countries from https://gist.github.com/kalinchernev/486393efcca01623b18d
. import delimited list_of_countries.csv, clear varnames(1)
(1 var, 196 obs)
. save list_of_countries, replace
file list_of_countries.dta saved
.
. timer clear
.
. * doing with a list of countries, each country once, 196 observations
. describe, short
Contains data from list_of_countries.dta
obs: 196
vars: 1 18 Feb 2019 21:56
size: 5,880
Sorted by:
. timeit 1: qui rcallcountrycode country, from(country.name.en) to(country.name.en) gen(r_name) marker
. timeit 2: qui kountry country, from(other) marker
NAMES_STD MARKER
. timer list
1: 4.09 / 1 = 4.0870
2: 0.02 / 1 = 0.0160
.
. * compare results. lowercase is rcallcountrycode; uppercase is kountry
. tab marker MARKER
| MARKER
marker | 0 1 | Total
-----------+----------------------+----------
0 | 1 1 | 2
1 | 5 189 | 194
-----------+----------------------+----------
Total | 6 190 | 196
.
. * now with the same list, duplicated many times, as in a large dataset
. * 392k rows with 196 countries. with gtools and ftools installed
. clear
. forvalues k = 1/2000 {
2. append using list_of_countries
3. }
.
. * compare results
. describe, short
Contains data
obs: 392,000
vars: 1
size: 11,760,000
Sorted by:
Note: Dataset has changed since last saved.
. timeit 3: qui rcallcountrycode country, from(country.name.en) to(country.name.en) gen(r_name) marker
. timeit 4: qui kountry country, from(other) marker
NAMES_STD MARKER
. timer list
1: 4.09 / 1 = 4.0870
2: 0.02 / 1 = 0.0160
3: 4.54 / 1 = 4.5400
4: 17.88 / 1 = 17.8780
.
. * Compare relative performances as dataset increases 2000 times:
. di "rcallcountrycode's time of execution increased by a relative factor of"
rcallcountrycode's time of execution increased by a relative factor of
. di r(t3)/r(t1) - 1
.11083925
. di "rcallcountrycode's time of execution increased by a relative factor of"
rcallcountrycode's time of execution increased by a relative factor of
. di r(t4)/r(t2) - 1
1116.375
.
. log close
name: <unnamed>
log: D:\repos\stata-rcallcountrycode\benchmark\benchmark.log
log type: text
closed on: 18 Feb 2019, 21:57:21
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------