mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-01-12 17:08:39 -09:00
scan.zig: Revamp output API, reduce buffering a bit, re-add UI
New output API takes over (most of) the buffering responsibilites from the scanning code, simplifying that code and allowing for a few minor optimizations, such as not buffering at all when scanning into RAM and buffering directly into JSON strings when exporting. This is mostly yak shaving, hopefully allowing for further performance improvements to be implemented later. The new API could also be extended to support parallel scanning of disjoint trees, in case current approach isn't working out too well. Also re-added the progress UI and improved propagating read errors. A visible side effect of the new API is that the progress UI now displays the most recent directory being scanned rather than individual files. Not a big loss, I hope?
This commit is contained in:
parent
c27dca1fba
commit
fe2340876d
3 changed files with 632 additions and 596 deletions
|
|
@ -848,10 +848,8 @@ pub fn keyInput(ch: i32) void {
|
|||
'r' => {
|
||||
if (!main.config.can_refresh.?)
|
||||
message = "Directory refresh feature disabled."
|
||||
else {
|
||||
else
|
||||
main.state = .refresh;
|
||||
scan.setupRefresh(dir_parent);
|
||||
}
|
||||
},
|
||||
'b' => {
|
||||
if (!main.config.can_shell.?)
|
||||
|
|
|
|||
|
|
@ -428,7 +428,7 @@ pub fn main() void {
|
|||
}
|
||||
}
|
||||
|
||||
var scan_dir: ?[]const u8 = null;
|
||||
var scan_dir: ?[:0]const u8 = null;
|
||||
var import_file: ?[:0]const u8 = null;
|
||||
var export_file: ?[:0]const u8 = null;
|
||||
{
|
||||
|
|
@ -499,7 +499,7 @@ pub fn main() void {
|
|||
while (true) {
|
||||
switch (state) {
|
||||
.refresh => {
|
||||
scan.scan();
|
||||
scan.refresh(browser.dir_parent);
|
||||
state = .browse;
|
||||
browser.loadDir(null);
|
||||
},
|
||||
|
|
|
|||
1220
src/scan.zig
1220
src/scan.zig
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue