Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(term): add benchmark for rendering #93

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
186 changes: 186 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 @@ -23,6 +23,7 @@ axum-server = { version = "0.6.0", features = ["tls-rustls"] }
bitflags = { version = "2.6.0", default-features = false }
chrono = { version = "0.4.38", default-features = false }
clap = { version = "4.5", default-features = false }
criterion = { version = "0.5.1", features = ["async_tokio"] }
either = { version = "1.13.0" }
fake = { version = "2.9.2", features = ["derive", "chrono"] }
fdlimit = { version = "0.3.0", default-features = false }
Expand Down
27 changes: 16 additions & 11 deletions crates/synd_term/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ serde = { workspace = true, features = ["derive"] }
serde_json = "1.0.120"
thiserror = { workspace = true }
tokio = { workspace = true, features = ["macros", "rt-multi-thread", "sync", "time"] }
tokio-stream = { version = "0.1.15", optional = true }
toml = { version = "0.8.14", default-features = true }
tracing = { workspace = true }
tracing-appender = "0.2.3"
Expand All @@ -60,22 +61,26 @@ url = { workspace = true }

[features]
# Integration test
integration = []
integration = ["dep:tokio-stream"]

[dev-dependencies]
synd-api = { path = "../synd_api" }
synd-test = { path = "../synd_test" }

assert_cmd = { workspace = true }
axum-server = { workspace = true }
fake = { workspace = true }
insta = { workspace = true }
kvsd = { workspace = true }
proptest = { workspace = true }
serial_test = { version = "3.1.1", default-features = false, features = ["async", "file_locks"] }
tempfile = { workspace = true }
tokio-stream = "0.1.15"
tokio-util = { workspace = true }
assert_cmd = { workspace = true }
axum-server = { workspace = true }
criterion = { workspace = true }
fake = { workspace = true }
insta = { workspace = true }
kvsd = { workspace = true }
proptest = { workspace = true }
serial_test = { version = "3.1.1", default-features = false, features = ["async", "file_locks"] }
tempfile = { workspace = true }
tokio-util = { workspace = true }

[[bench]]
harness = false
name = "render"

[lints]
workspace = true
Expand Down
40 changes: 40 additions & 0 deletions crates/synd_term/benches/bench/helper.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
use std::time::Duration;

use ratatui::backend::TestBackend;
use synd_term::{
application::{Application, Cache, Config},
client::Client,
config::Categories,
terminal::Terminal,
ui::theme::Theme,
};
use url::Url;

pub fn init_app() -> Application {
let terminal = {
let backend = TestBackend::new(120, 40);
let terminal = ratatui::Terminal::new(backend).unwrap();
Terminal::with(terminal)
};

let client = {
Client::new(
Url::parse("http://dummy.ymgyt.io").unwrap(),
Duration::from_secs(10),
)
.unwrap()
};

let config = { Config::default().with_idle_timer_interval(Duration::from_micros(1)) };

let cache = { Cache::new(tempfile::TempDir::new().unwrap().into_path()) };

Application::builder()
.terminal(terminal)
.client(client)
.categories(Categories::default_toml())
.config(config)
.cache(cache)
.theme(Theme::default())
.build()
}
Loading