@@ -193,7 +193,7 @@ impl InputData {
193
193
let repo_loc = PathBuf :: from ( repo_loc) ;
194
194
let mut skipped = 0 ;
195
195
let mut artifact_data = BTreeMap :: new ( ) ;
196
- let mut data = BTreeMap :: new ( ) ;
196
+ let mut data = HashMap :: new ( ) ;
197
197
198
198
if !repo_loc. exists ( ) {
199
199
// If the repository doesn't yet exist, simplify clone it to the given location.
@@ -214,19 +214,36 @@ impl InputData {
214
214
trace ! ( "loading files from directory" ) ;
215
215
216
216
// Read all files from repo_loc/processed
217
- let mut file_count = 0 ;
217
+ let mut files = Vec :: new ( ) ;
218
218
for entry in fs:: read_dir ( repo_loc. join ( "times" ) ) ? {
219
219
let entry = entry?;
220
220
if entry. file_type ( ) ?. is_dir ( ) {
221
221
continue ;
222
222
}
223
- file_count += 1 ;
224
-
225
223
let filename = entry. file_name ( ) ;
226
224
let filename = filename. to_str ( ) . unwrap ( ) ;
227
225
let file_contents =
228
226
fs:: read ( entry. path ( ) ) . with_context ( || format ! ( "Failed to read {}" , filename) ) ?;
229
227
228
+ files. push ( ( filename. to_owned ( ) , file_contents) ) ;
229
+ }
230
+
231
+ trace ! ( "read directory" ) ;
232
+
233
+ data. reserve ( files. len ( ) ) ;
234
+ for ( filename, file_contents) in & files {
235
+ let c;
236
+ let file_contents = if filename. ends_with ( ".sz" ) {
237
+ use std:: io:: Read ;
238
+ let mut out = Vec :: with_capacity ( snap:: decompress_len ( & file_contents) . unwrap_or ( 0 ) ) ;
239
+ let mut szip_reader = snap:: Reader :: new ( & file_contents[ ..] ) ;
240
+ szip_reader. read_to_end ( & mut out) . unwrap ( ) ;
241
+ c = out;
242
+ & c
243
+ } else {
244
+ & file_contents
245
+ } ;
246
+
230
247
if filename. starts_with ( "artifact-" ) {
231
248
let contents: ArtifactData = match serde_json:: from_slice ( & file_contents) {
232
249
Ok ( j) => j,
@@ -262,7 +279,7 @@ impl InputData {
262
279
}
263
280
}
264
281
265
- info ! ( "{} total files" , file_count ) ;
282
+ info ! ( "{} total files" , files . len ( ) ) ;
266
283
info ! ( "{} skipped files" , skipped) ;
267
284
info ! ( "{} measured" , data. len( ) ) ;
268
285
@@ -275,7 +292,7 @@ impl InputData {
275
292
}
276
293
} ;
277
294
278
- InputData :: new ( data, artifact_data, config)
295
+ InputData :: new ( data. into_iter ( ) . collect ( ) , artifact_data, config)
279
296
}
280
297
281
298
pub fn new (
0 commit comments