Skip to content

Commit

Permalink
Benchmarks are running again
Browse files Browse the repository at this point in the history
  • Loading branch information
jaytaph committed Nov 19, 2024
1 parent 3c557d4 commit 8e1683b
Show file tree
Hide file tree
Showing 16 changed files with 1,215 additions and 48 deletions.
72 changes: 72 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ gosub_shared = { path = "./crates/gosub_shared", features = [] }
gosub_html5 = { path = "./crates/gosub_html5", features = [] }
gosub_css3 = { path = "./crates/gosub_css3", features = [] }
gosub_renderer = { path = "./crates/gosub_renderer", features = [] }
mockall = "0.13.0"

[dev-dependencies]
criterion = { version = "0.5", features = ["html_reports"] }
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ TODO / Test cases we need to cover:
- [X] allow user to add nodes to DOM, build a document with a DocumentBuilder
- [X] allow user to parse a html5 string and return (random) nodes in a DOM document from it.
- [X] attach CSS stylesheets to the DOM
- [ ] let user query the DOM for nodes
- [ ] let user query the DOM for nodes with a specific CSS selector
- [X] let user query the DOM for nodes
- [-] let user query the DOM for nodes with a specific CSS selector
- [X] allow user that adds an attribute to a (element) node automatically set the named_ids in the document.
- [ ] allow user to retrieve info from the node from its element data (like node_id, doc_handle)
- [X] allow user to modify node data from document element (don't know it this is needed / feasable)
- [ ] add document task queue (optional for now)
- [X] Allow callers to update attributes in nodes in an efficient way
- [X] add document task queue
- [X] Allow callers to update attributes in nodes in an efficient way
- [-] allow user to retrieve info from the node from its element data (like node_id, doc_handle)
24 changes: 15 additions & 9 deletions benches/node_update.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use gosub_css3::MyCssSystem;
use gosub_css3::css3parser::MyCss3Parser;
use gosub_css3::stylesheet::{CssDeclaration, CssRule, CssStylesheet, CssValue};
use gosub_html5::document::builder::DocumentBuilder;
use gosub_html5::document::document::MyDocument;
use gosub_html5::html5parser::MyHtmlParser;
use gosub_renderer::backend::MyRenderBackend;
use gosub_renderer::layouter::MyLayouter;
use gosub_renderer::render_tree::MyRenderTree;
use gosub_renderer::tree_drawer::MyTreeDrawer;
use gosub_renderer::backend::ratatui::backend::MyRatatuiRenderBackend;
use gosub_renderer::layouter::basic_layouter::BasicLayouter;
use gosub_renderer::render_tree::render_tree::MyRenderTree;
use gosub_renderer::tree_drawer::tree_drawer::MyTreeDrawer;
use gosub_shared::node_id::NodeId;
use gosub_shared::traits::css_system::HasCssSystem;
use gosub_shared::traits::css_system::{HasCssParser, HasCssSystem};
use gosub_shared::traits::document::{Document, HasDocument};
use gosub_shared::traits::html5_parser::{HasHtmlParser, HtmlParser};
use gosub_shared::traits::layouter::HasLayouter;
Expand All @@ -22,7 +23,10 @@ use gosub_shared::traits::tree_drawer::HasTreeDrawer;
struct MyModuleConfiguration;

impl HasCssSystem for MyModuleConfiguration {
type CssSystem = MyCssSystem;
type CssStylesheet = CssStylesheet;
type CssRule = CssRule;
type CssDeclaration = CssDeclaration;
type CssValue = CssValue;
}

impl HasDocument for MyModuleConfiguration {
Expand All @@ -35,7 +39,7 @@ impl HasHtmlParser for MyModuleConfiguration {
}

impl HasLayouter for MyModuleConfiguration {
type Layouter = MyLayouter<Self>;
type Layouter = BasicLayouter<Self>;
}

impl HasRenderTree for MyModuleConfiguration {
Expand All @@ -47,9 +51,11 @@ impl HasTreeDrawer for MyModuleConfiguration {
}

impl HasRenderBackend for MyModuleConfiguration {
type RenderBackend = MyRenderBackend;
type RenderBackend = MyRatatuiRenderBackend<Self>;
}

impl HasCssParser for MyModuleConfiguration { type CssParser = MyCss3Parser<Self>; }

impl ModuleConfiguration for MyModuleConfiguration {}

fn bench_test_attach<C: ModuleConfiguration>(c: &mut Criterion) {
Expand Down
1 change: 1 addition & 0 deletions crates/gosub_html5/src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ mod document_events;
pub mod query_processor;
pub mod tree_iterator;
pub mod walker;
pub(crate) mod task_queue;
10 changes: 5 additions & 5 deletions crates/gosub_html5/src/document/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ pub struct MyDocument<C: HasCssSystem + HasDocument> {
_marker: std::marker::PhantomData<C>,
}

// impl<C: HasDocument> HasDocument for MyDocument<C> {
// type Document = MyDocument<C>;
// type Node = Node;
// }

impl<C: HasCssSystem + HasDocument> HasCssSystem for MyDocument<C> {
type CssStylesheet = C::CssStylesheet;
type CssRule = C::CssRule;
Expand Down Expand Up @@ -134,3 +129,8 @@ impl<C: HasCssSystem + HasDocument> Document<C> for MyDocument<C> {
qp.query(query)
}
}


#[cfg(test)]
mod tests {
}
Loading

0 comments on commit 8e1683b

Please sign in to comment.