You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-12Lines changed: 28 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,6 +102,7 @@ assert_eq!(-3, TEST[1][2]);
102
102
assert_eq!(-4, TEST[1][3]);
103
103
assert_eq!(-5, TEST[1][4]);
104
104
```
105
+
105
106
```rust
106
107
#[macro_use] externcrate lazy_static_include;
107
108
#[macro_use] externcrate lazy_static;
@@ -115,24 +116,39 @@ assert_eq!("哈囉", TEST[2]);
115
116
116
117
## Benchmark
117
118
118
-
Using static mechanisms makes your program faster. See my benchmark result below (Intel i7-6700HQ, ran on 2018/09/10):
119
+
Using static mechanisms makes your program faster. See my benchmark result below (Intel i7-6700HQ, ran on 2018/11/14):
119
120
120
121
```text
121
-
running 9 tests
122
-
test include_array_lazy_static ... bench: 44 ns/iter (+/- 2)
123
-
test include_array_native_static ... bench: 44 ns/iter (+/- 2)
124
-
test include_array_no_static ... bench: 8,470 ns/iter (+/- 568)
125
-
test include_bytes_lazy_static ... bench: 473 ns/iter (+/- 84)
126
-
test include_bytes_native_static ... bench: 482 ns/iter (+/- 30)
127
-
test include_bytes_no_static ... bench: 7,247 ns/iter (+/- 1,183)
128
-
test include_str_lazy_static ... bench: 963 ns/iter (+/- 85)
129
-
test include_str_native_static ... bench: 970 ns/iter (+/- 76)
130
-
test include_str_no_static ... bench: 8,338 ns/iter (+/- 556)
122
+
include_str/include_str_no_static
123
+
time: [8.3773 us 8.4061 us 8.4361 us]
124
+
include_str/include_str_native_static
125
+
time: [965.65 ns 969.47 ns 973.04 ns]
126
+
include_str/include_str_lazy_static
127
+
time: [955.93 ns 958.78 ns 961.88 ns]
128
+
129
+
include_bytes/include_bytes_no_static
130
+
time: [7.7806 us 7.8056 us 7.8318 us]
131
+
include_bytes/include_bytes_native_static
132
+
time: [418.43 ns 420.12 ns 421.83 ns]
133
+
include_bytes/include_bytes_lazy_static
134
+
time: [413.43 ns 415.14 ns 417.37 ns]
135
+
136
+
include_array/include_array_no_static
137
+
time: [30.125 us 30.285 us 30.445 us]
138
+
include_array/include_array_native_static
139
+
time: [38.510 ns 38.640 ns 38.786 ns]
140
+
include_array/include_array_lazy_static
141
+
time: [39.713 ns 39.863 ns 40.019 ns]
131
142
```
132
143
133
-
This benchmark program is in `tests/benchmark.rs`.
134
144
When using the **release** profile, the performance of `lazy_static_include_*` is very close to `include_*`. That means you don't need to worry about the overhead, but just enjoy the faster compilation time.
0 commit comments