felix
felix copied to clipboard
Disable preview on media files
When preview is enabled, iterate over webm
files (YouTube
videos ~1.5Gb) take very long time.
Maybe add some kind of filter for preview big or media files to not block the ui?
Yeah, very good point. I'll consider it.
@balroggg Hi, a little bit different topic, but I introduced hpjansson / chafa instead of libsixel/viuer. chafa likely outperforms libsixel, and this will greatly improve the code maintainability. If you can install chafa, could you try this one? (alt-image branch) Thanks in advance.
When it comes to previewing heavy files, it seems to take less time to move cursor by chafa. At the first point chafa does not support video files yet, so it would be better to disable preview for videos if I use chafa.
Hi, chafa
branch works well, easy install on Archlinux also.
It's more about previewing big files I think. For example I notice the same behavior with big archive files.
Hm. For example, how big is that file you feel problematic?
Old backup of home folder tar.zst file 1GB for example, freeze fx ~15sec.
And I found that fx
aborted on preview ova file 25GB(old image of virtual machine) with big memory allocation.
Add backtrace of abort
#0 0x00007ffff7d374dc in ?? () from /usr/lib/libc.so.6
#1 0x00007ffff7ce7998 in raise () from /usr/lib/libc.so.6
#2 0x00007ffff7cd153d in abort () from /usr/lib/libc.so.6
#3 0x0000555555a08da7 in std::sys::unix::abort_internal () at library/std/src/sys/unix/mod.rs:259
#4 0x00005555555c8cc7 in std::process::abort () at library/std/src/process.rs:2087
#5 0x0000555555a019de in std::alloc::rust_oom () at library/std/src/alloc.rs:339
#6 0x0000555555a1ef97 in alloc::alloc::__alloc_error_handler::__rg_oom () at library/alloc/src/alloc.rs:413
#7 0x0000555555a1ef87 in alloc::alloc::handle_alloc_error::rt_error () at library/alloc/src/alloc.rs:379
#8 0x0000555555a1ecd7 in core::ops::function::FnOnce::call_once<fn(core::alloc::layout::Layout) -> !, (core::alloc::layout::Layout)> () at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/ops/function.rs:248
#9 0x0000555555a1ecc6 in core::intrinsics::const_eval_select<(core::alloc::layout::Layout), fn(core::alloc::layout::Layout) -> !, fn(core::alloc::layout::Layout) -> !, !> () at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/intrinsics.rs:2372
#10 0x00005555555c9c56 in alloc::alloc::handle_alloc_error () at library/alloc/src/alloc.rs:383
#11 0x00005555555c8a4b in alloc::raw_vec::handle_reserve () at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/alloc/src/raw_vec.rs:489
#12 alloc::raw_vec::{impl#1}::reserve::do_reserve_and_handle<u8, alloc::alloc::Global> () at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/alloc/src/raw_vec.rs:285
#13 0x00005555559f9019 in alloc::raw_vec::RawVec::reserve<u8, alloc::alloc::Global> () at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/alloc/src/raw_vec.rs:289
#14 alloc::vec::Vec::reserve<u8, alloc::alloc::Global> () at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/alloc/src/vec/mod.rs:815
#15 alloc::string::String::reserve () at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/alloc/src/string.rs:1030
#16 std::fs::{impl#5}::read_to_string () at library/std/src/fs.rs:660
#17 0x00005555559f8a4f in std::fs::read_to_string::inner () at library/std/src/fs.rs:287
#18 0x000055555566cf91 in std::fs::read_to_string<std::path::PathBuf> (path=...) at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/fs.rs:290
#19 0x000055555569f4f7 in fx::state::State::preview_text (self=0x555555ba40d8, item=0x555555bae6c8) at src/state.rs:1152
#20 0x000055555569d630 in fx::state::State::move_cursor (self=0x555555ba40d8, nums=0x555555b9ade8, y=16) at src/state.rs:1040
#21 0x000055555568ef24 in fx::state::State::redraw (self=0x555555ba40d8, nums=0x555555b9ade8, y=16) at src/state.rs:743
#22 0x0000555555687466 in fx::state::State::refresh (self=0x555555ba40d8, column=191, row=47, nums=0x555555b9ade8, cursor_pos=16) at src/state.rs:189
#23 0x0000555555614a82 in fx::run::run (arg=..., log=false) at src/run.rs:842
#24 0x00005555555fadda in fx::main () at src/main.rs:18
Very useful information! Thank you. It sounds at least the file size check should be done before showing preview.
Maybe this helps a little, it's a crate from bat https://github.com/sharkdp/content_inspector/blob/master/examples/inspect.rs
Thanks, that crate really helps.
alt-image
branch was merged into develop
:
- Use
chafa
instead oflibsixel
&viuer
to preview image files. This greatly improves the performance and code maintainability, and as a consequence, the number of dependencies is reduced (137 -> ~51~ 53). - With
chafa
, the hi-res image preview is supported in kitty and iTerm2. - Files larger than 1GB are no longer previewed in order to improve the performance.
- Remove profile.release to support older version of Rust.
I hope this change (especially libsixel -> chafa) will lead to a good user experience.
After bug checking and updating the README, I'll put out the next release (probably 1.1.0).