Skip to content

Commit

Permalink
Merge branch 'release/1.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
nimaaskarian committed Oct 13, 2024
2 parents 8ff92cd + d9d4781 commit 9a9d6a3
Show file tree
Hide file tree
Showing 20 changed files with 815 additions and 1,271 deletions.
361 changes: 347 additions & 14 deletions Cargo.lock

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "c3"
version = "1.5.1"
version = "1.6.0"
edition = "2021"

[dependencies]
Expand All @@ -18,3 +18,10 @@ codegen-units = 1
lto = "fat"
panic = "abort"
strip = "debuginfo"

[dev-dependencies]
criterion = { version = "0.5", features = ["html_reports"] }

[[bench]]
name = "bench_500k"
harness = false
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ The default mode of the app is TUI mode. Keybinds are vim-like. Here they are:
| J | increase todo priority |
| K | decrease todo priority |
| @ | restrict todos by priority |
| % | restrict todos by schedule day |
| d | toggle daily |
| W | toggle weekly |
| S | set custom schedule |
Expand All @@ -80,11 +81,20 @@ The default mode of the app is TUI mode. Keybinds are vim-like. Here they are:
| Ctrl+d | sort by todo's abandonment (how hasn't been done compared to their schedule) |
| w | write changes to file |
| R | read from file (discard changes)|
#### Modules
TUI mode has a section called module. You can develop modules, and assign methods to Module trait methods.
A very simple example has been done by default for [potato-c](https://github.com/nimaaskarian/potato-c).

Keybinds that modules can use are **C, c, H, L, comma, period, +, -, s, r**
#### [potato-c](https://github.com/nimaaskarian/potato-c) module keybinds
| key | action |
|---|---|
| s | skip current |
| H | increase timer |
| L | decrease timer |
| +,= | increase pomodoro count |
| - | decrease pomodoro count |
| c | toggle pause |
| C | quit |
| f | restart |
| . | next server |
| , | prev server |

### Non interactive mode
For command line arguments and such, run `c3 -h` to see full usage.
Expand Down
61 changes: 61 additions & 0 deletions benches/bench_500k.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
use criterion::{criterion_group, criterion_main, Criterion};
use std::{env, hint::black_box, path::PathBuf};

use c3::{todo_app::App, AppArgs};

fn sort(c: &mut Criterion) {
let mut app = App::new(AppArgs {
todo_path: PathBuf::from("../fuckc3-todo"),
..Default::default()
});
c.bench_function("sort 500k todos", |b| b.iter(|| black_box(&mut app).read()));
}

fn reorder(c: &mut Criterion) {
let mut app = App::new(AppArgs {
todo_path: PathBuf::from("../fuckc3-todo"),
..Default::default()
});
c.bench_function("reorder 500k todos", |b| {
b.iter(|| {
app.index = 400000;
black_box(&mut app).set_current_priority(1);
})
});
}

fn display(c: &mut Criterion) {
let mut app = App::new(AppArgs {
todo_path: PathBuf::from("../fuckc3-todo"),
..Default::default()
});
c.bench_function("display 500k todos", |b| {
b.iter(|| {
black_box(&mut app).display_current_list();
})
});
}

fn write_to_stdout(c: &mut Criterion) {
let app = App::new(AppArgs {
todo_path: PathBuf::from("../fuckc3-todo"),
..Default::default()
});
c.bench_function("write to stdout 500k todos", |b| {
b.iter(|| black_box(&app.todo_list).write_to_stdout())
});
}

fn batch_edit(c: &mut Criterion) {
let mut app = App::new(AppArgs {
todo_path: PathBuf::from("../fuckc3-todo"),
..Default::default()
});
env::set_var("EDITOR", "cat");
c.bench_function("batch edit 500k todos", |b| {
b.iter(|| black_box(&mut app).batch_editor_messages())
});
}

criterion_group!(benches, sort, reorder, display, write_to_stdout, batch_edit);
criterion_main!(benches);
Loading

0 comments on commit 9a9d6a3

Please sign in to comment.