From 86941305a459a47e7377943690efd9b3d0cefae0 Mon Sep 17 00:00:00 2001 From: unspeaker Date: Mon, 8 Sep 2025 00:31:37 +0300 Subject: [PATCH] perf: use mold --- Cargo.toml | 2 +- Justfile | 6 ++++-- deps/tengri | 2 +- shell.nix | 46 +++++++++++++++++++++++++++------------------- tek/Cargo.toml | 3 +++ tek/tek.edn | 2 +- tek/tek.rs | 7 ++++--- 7 files changed, 41 insertions(+), 27 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 14b1da71..396c69f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ path = "./deps/tengri/proc" path = "./deps/rust-jack" [workspace.dependencies] -tek = { path = "./tek" } +tek = { path = "./tek" } atomic_float = { version = "1.0.0" } backtrace = { version = "0.3.72" } diff --git a/Justfile b/Justfile index 199d5799..b783e089 100644 --- a/Justfile +++ b/Justfile @@ -1,4 +1,4 @@ -export RUSTFLAGS := "--cfg procmacro2_semver_exempt -Zmacro-backtrace" +export RUSTFLAGS := "--cfg procmacro2_semver_exempt -Zmacro-backtrace -Clink-arg=-fuse-ld=mold" export RUST_BACKTRACE := "1" debug := "reset && cargo run --" @@ -19,7 +19,9 @@ default: bacon: bacon -s check: - cargo check + reset && cargo check +build: + reset && cargo build run: {{debug}} run-init: diff --git a/deps/tengri b/deps/tengri index 18b68039..a4dbf882 160000 --- a/deps/tengri +++ b/deps/tengri @@ -1 +1 @@ -Subproject commit 18b6803912105cc6a23217641a68967695a2166b +Subproject commit a4dbf88220f75ccaf9d14cc2e4fb7c00479e3940 diff --git a/shell.nix b/shell.nix index 7f22e603..8782e6dd 100755 --- a/shell.nix +++ b/shell.nix @@ -1,32 +1,40 @@ #!/usr/bin/env nix-shell {pkgs?import{}}:let - stdenv = pkgs.clang19Stdenv; name = "tek"; - nativeBuildInputs = with pkgs; [ pkg-config freetype libclang ]; - buildInputs = with pkgs; let - #suil = pkgs.enableDebugging (pkgs.suil.overrideAttrs (a: b: { - #dontStrip = true; separateDebugInfo = true; - #})); - in [ jack2 lilv serd libclang /*suil*/ glib gtk3 ]; + stdenv = pkgs.clang19Stdenv; + nativeBuildInputs = [ + pkgs.pkg-config + pkgs.freetype + pkgs.libclang + pkgs.mold + ]; + buildInputs = [ + pkgs.jack2 + pkgs.lilv + pkgs.serd + pkgs.libclang + ]; VST3_SDK_DIR = "/home/user/Lab/Music/tek/vst3sdk/"; LIBCLANG_PATH = "${pkgs.libclang.lib.outPath}/lib"; - LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (with pkgs; [ - pipewire.jack + LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [ + pkgs.pipewire.jack # for ChowKick.lv2: - freetype - libgcc.lib + pkgs.freetype + pkgs.libgcc.lib # for Panagement - xorg.libX11 - xorg.libXcursor - xorg.libXi - libxkbcommon + pkgs.xorg.libX11 + pkgs.xorg.libXcursor + pkgs.xorg.libXi + pkgs.libxkbcommon + pkgs.lilv + pkgs.serd #suil # for Helm: - alsa-lib - curl - libglvnd + pkgs.alsa-lib + pkgs.curl + pkgs.libglvnd #xorg_sys_opengl - ]); + ]; in pkgs.mkShell.override { inherit stdenv; } { diff --git a/tek/Cargo.toml b/tek/Cargo.toml index 3e005db3..f29213a0 100644 --- a/tek/Cargo.toml +++ b/tek/Cargo.toml @@ -10,6 +10,9 @@ path = "tek.rs" name = "tek" path = "tek_cli.rs" +[target.'cfg(target_os = "linux")'] +rustflags = ["-C", "link-arg=-fuse-ld=mold"] + [dependencies] tengri = { workspace = true } tengri_proc = { workspace = true } diff --git a/tek/tek.edn b/tek/tek.edn index 8f4c82d0..30849ccb 100644 --- a/tek/tek.edn +++ b/tek/tek.edn @@ -32,7 +32,7 @@ (mode :menu (keys :axis/y :confirm) :menu) (keys :confirm (@enter confirm)) -(view :menu (bg (g 40) (bsp/s +(view :menu (bg (g 0) (bsp/s :ports/out (bsp/n :ports/in (bg (g 30) (bsp/s (fixed/y 7 :logo) (fill/xy :dialog/menu))))))) (view :ports/out (fill/x (fixed/y 3 (bsp/a diff --git a/tek/tek.rs b/tek/tek.rs index 8fb554c2..7ff10600 100644 --- a/tek/tek.rs +++ b/tek/tek.rs @@ -268,8 +268,9 @@ impl ScenesView for App { impl Draw for App { fn draw (&self, to: &mut TuiOut) { - for dsl in self.mode.view.iter() { - let _ = self.view(to, dsl).expect("render failed"); + for (index, dsl) in self.mode.view.iter().enumerate() { + to.place(&Align::nw(Push::y(1 + index as u16 * 2, dsl.src().unwrap()))); + //let _ = self.view(to, dsl).expect("render failed"); } } } @@ -449,7 +450,7 @@ impl App { Some("menu") => to.place(&if let Dialog::Menu(selected, items) = &self.dialog { let items = items.clone(); let selected = selected; - Some(Fill::x(Thunk::new(move|to: &mut TuiOut|{ + Some(Fill::xy(Thunk::new(move|to: &mut TuiOut|{ for (index, MenuItem(item, _)) in items.0.iter().enumerate() { to.place(&Push::y((2 * index) as u16, Tui::fg_bg(