mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 09:17:30 +03:00
ab3a7cb21f
Summary: In preparation for merging fb-mercurial sources to the Eden repository, move everything from the top-level directory into an `eden/scm` subdirectory.
38 lines
1.0 KiB
Rust
38 lines
1.0 KiB
Rust
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This software may be used and distributed according to the terms of the
|
|
* GNU General Public License version 2.
|
|
*/
|
|
|
|
use std::io::Write;
|
|
|
|
use bytes::Bytes;
|
|
use minibench::{bench, elapsed};
|
|
|
|
use configparser::config::ConfigSet;
|
|
|
|
fn main() {
|
|
bench("parse 645KB file", || {
|
|
let mut config_file = Vec::new();
|
|
for _ in 0..100 {
|
|
for section in b'a'..b'z' {
|
|
config_file
|
|
.write(format!("[{ch}{ch}{ch}{ch}]\n", ch = section as char).as_bytes())
|
|
.unwrap();
|
|
for name in b'a'..b'z' {
|
|
config_file
|
|
.write(
|
|
format!("{ch}{ch}{ch} = {ch}{ch}{ch}\n", ch = name as char).as_bytes(),
|
|
)
|
|
.unwrap();
|
|
}
|
|
}
|
|
}
|
|
elapsed(|| {
|
|
let mut cfg = ConfigSet::new();
|
|
cfg.parse(Bytes::from(&config_file[..]), &"bench".into());
|
|
})
|
|
});
|
|
}
|