Time json-ld operations
This commit is contained in:
parent
e8f119847a
commit
b71e88c2e4
|
@ -8,6 +8,7 @@ use locspan::{Location, Span};
|
|||
use rdf_types::{generator::Blank, IriVocabularyMut};
|
||||
use reqwest::Client;
|
||||
use static_iref::iri;
|
||||
use std::time::Instant;
|
||||
|
||||
const SIMPLE_CONTEXT: &str = r#"[
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
|
@ -131,13 +132,16 @@ async fn normalize_document(iri: Iri<'static>, document: &str) -> Result<(), Any
|
|||
|
||||
expanded.identify_all_with(&mut vocabulary, &mut pre_gen);
|
||||
|
||||
let start = Instant::now();
|
||||
let output_document = json_ld_normalization::normalize::<_, _, _, sha2::Sha256>(
|
||||
&mut vocabulary,
|
||||
iri_index,
|
||||
expanded.0,
|
||||
true,
|
||||
)?;
|
||||
println!("normalization took {}ms", start.elapsed().as_millis());
|
||||
|
||||
let start = Instant::now();
|
||||
let serialized = json_ld_serialization::rdf_to_json_ld(
|
||||
output_document.into_quads(),
|
||||
Location::new(iri_index.clone(), Span::default()),
|
||||
|
@ -149,7 +153,7 @@ async fn normalize_document(iri: Iri<'static>, document: &str) -> Result<(), Any
|
|||
)
|
||||
.expect("Failed to normalize");
|
||||
|
||||
println!("{}", serialized.pretty_print());
|
||||
println!("serialization took {}ms", start.elapsed().as_millis());
|
||||
|
||||
let expanded = ExpandedDocument::try_from_json_in(&mut vocabulary, serialized)
|
||||
.expect("Invalid expanded json");
|
||||
|
|
Loading…
Reference in a new issue