Skip to content

Conversation

@tilladam
Copy link
Contributor

@tilladam tilladam commented Jan 5, 2026

  • Add divan benchmarks for compiler semantic analysis phase (internal/compiler/benches/semantic_analysis.rs)

  • Add custom allocator to track allocations in the benchmark.

  • Add benches for individual phases of compilation and a proc-macro simulation mode.

  • Document allocation hotspots and optimization strategies (docs/semantic-analysis-optimization.md)

Benchmarks cover:

  • Lexing and parsing performance
  • Full compilation with various stress scenarios
  • Specific hotspots: many children, properties, exports, states, nested components, deep expressions, binding chains

The optimization doc identifies key issues:

  • O(n²) export sorting
  • Element duplication in inlining pass
  • Incremental Vec growth patterns
  • SmallVec sizing recommendations

));
}

/// Phase 3: Load dependencies (style-base.slint and its deps)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no style-base.slint in the repo or in this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that snuck in from a refactoring later in the patch series. The one that acutally improves the benchmark ;). Will fix.

// Benchmark just the import_component calls
let mut build_diags_to_ignore = BuildDiagnostics::default();
let _style_metrics = spin_on::spin_on(loader.import_component(
"style-base.slint",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, it's not just a comment, it's referred to here

&mut build_diags_to_ignore,
));
divan::black_box((_style_metrics, _palette));
use super::*;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leftover? doesn't seem useful here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patch order problem, yes. I wanted to present the benchmark separately from the changes, which apparently didn't quite work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess your reply was for the previous comment.

This one is about use super::*;

- Add divan benchmarks for compiler semantic analysis phase
  (internal/compiler/benches/semantic_analysis.rs)
- Add custom allocator to track allocations in the benchmark.
- Add benches for individual phases of compilation and a proc-macro simulation mode.

- Document allocation hotspots and optimization strategies
  (docs/semantic-analysis-optimization.md)

Benchmarks cover:
- Lexing and parsing performance
- Full compilation with various stress scenarios
- Specific hotspots: many children, properties, exports,
  states, nested components, deep expressions, binding chains

The optimization doc identifies key issues:
- O(n²) export sorting
- Element duplication in inlining pass
- Incremental Vec growth patterns
- SmallVec sizing recommendations
@tilladam tilladam force-pushed the compiler-benchmark branch from b2a065a to bcaf099 Compare January 6, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants