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: src/lib.rs
+9-20Lines changed: 9 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -129,26 +129,15 @@ default-features = false
129
129
Using static mechanisms makes your program faster. See my benchmark result below (Intel i7-6700HQ, ran on 2018/11/14):
130
130
131
131
```text
132
-
include_str/include_str_no_static
133
-
time: [8.3773 us 8.4061 us 8.4361 us]
134
-
include_str/include_str_native_static
135
-
time: [965.65 ns 969.47 ns 973.04 ns]
136
-
include_str/include_str_lazy_static
137
-
time: [955.93 ns 958.78 ns 961.88 ns]
138
-
139
-
include_bytes/include_bytes_no_static
140
-
time: [7.7806 us 7.8056 us 7.8318 us]
141
-
include_bytes/include_bytes_native_static
142
-
time: [418.43 ns 420.12 ns 421.83 ns]
143
-
include_bytes/include_bytes_lazy_static
144
-
time: [413.43 ns 415.14 ns 417.37 ns]
145
-
146
-
include_array/include_array_no_static
147
-
time: [30.125 us 30.285 us 30.445 us]
148
-
include_array/include_array_native_static
149
-
time: [38.510 ns 38.640 ns 38.786 ns]
150
-
include_array/include_array_lazy_static
151
-
time: [39.713 ns 39.863 ns 40.019 ns]
132
+
test include_array_lazy_static ... bench: 43 ns/iter (+/- 3)
133
+
test include_array_native_static ... bench: 46 ns/iter (+/- 4)
134
+
test include_array_no_static ... bench: 29,714 ns/iter (+/- 1,156)
135
+
test include_bytes_lazy_static ... bench: 382 ns/iter (+/- 63)
136
+
test include_bytes_native_static ... bench: 380 ns/iter (+/- 30)
137
+
test include_bytes_no_static ... bench: 9,076 ns/iter (+/- 1,224)
138
+
test include_str_lazy_static ... bench: 932 ns/iter (+/- 103)
139
+
test include_str_native_static ... bench: 937 ns/iter (+/- 25)
140
+
test include_str_no_static ... bench: 10,135 ns/iter (+/- 1,634)
152
141
```
153
142
154
143
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