/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/// Get a benchmark client to use for the tests /// /// Uses OnceLock to ensure we only construct it once. fn get_benchmark_client() -> RemoteSettingsBenchmarkClient { static CELL: OnceLock<RemoteSettingsBenchmarkClient> = OnceLock::new();
CELL.get_or_init(|| {
RemoteSettingsBenchmarkClient::new()
.unwrap_or_else(|e| panic!("Error creating benchmark client {e}"))
})
.clone()
}
// The input for each benchmark is `SuggestStoreInner` with a fresh database. // // This is wrapped in a newtype so that it can be exposed in the public trait pubstruct InputType(SuggestStoreInner<RemoteSettingsBenchmarkClient>);
impl BenchmarkWithInput for IngestBenchmark { type GlobalInput = (); type IterationInput = InputType;
fn global_input(&self) -> Self::GlobalInput {}
fn iteration_input(&self) -> Self::IterationInput { let data_path = self.temp_dir.path().join(unique_db_filename()); let store = SuggestStoreInner::new(data_path, vec![], self.client.clone());
store.ensure_db_initialized(); ifself.reingest {
store.ingest_records_by_type(self.record_type);
store.force_reingest();
}
InputType(store)
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.