Auto merge of #16748 - Veykril:on-demand-validation-err, r=Veykril

internal: Compute syntax validation errors on demand

The LRU cache causes us to re-parse trees quite often, yet we don't use the validation errors at all. With this we push calculating them off to the caller who is interested in them.
This commit is contained in:
bors 2024-03-04 11:19:16 +00:00
commit a7e9f12bf7
11 changed files with 45 additions and 44 deletions

View file

@ -55,7 +55,7 @@ fn integrated_highlighting_benchmark() {
vfs.file_id(&path).unwrap_or_else(|| panic!("can't find virtual file for {path}"))
};
crate::tracing::hprof::init("*>100");
let _g = crate::tracing::hprof::init("*>150");
{
let _it = stdx::timeit("initial");
@ -72,6 +72,8 @@ fn integrated_highlighting_benchmark() {
host.apply_change(change);
}
let _g = crate::tracing::hprof::init("*>50");
{
let _it = stdx::timeit("after change");
let _span = profile::cpu_span();

View file

@ -52,7 +52,7 @@ use tracing_subscriber::{
use crate::tracing::hprof;
pub fn init(spec: &str) {
pub fn init(spec: &str) -> tracing::subscriber::DefaultGuard {
let (write_filter, allowed_names) = WriteFilter::from_spec(spec);
// this filter the first pass for `tracing`: these are all the "profiling" spans, but things like
@ -76,7 +76,7 @@ pub fn init(spec: &str) {
.with_filter(profile_filter);
let subscriber = Registry::default().with(layer);
tracing::subscriber::set_global_default(subscriber).unwrap();
tracing::subscriber::set_default(subscriber)
}
#[derive(Default, Debug)]