From 179db5aeb6c51936242a33a4612d6f6c1dc88b88 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 10 Aug 2021 06:17:50 -0700 Subject: [PATCH] slack: takes almost 3 minutes to load 55MB This is with KVM on a pretty fast Thinkpad. If I exclude images, 14MB takes 45s to load. There's also a bug in parsing at the moment; it aborts after loading all records. --- browse_slack/main.mu | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/browse_slack/main.mu b/browse_slack/main.mu index f4a5abfb..c3e351d2 100644 --- a/browse_slack/main.mu +++ b/browse_slack/main.mu @@ -36,13 +36,14 @@ type item { # I try to put all the static buffer sizes in this function. fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk) { # load entire disk contents to a single enormous stream - draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, "loading data disk..", 3/fg 0/bg var s-h: (handle stream byte) # the stream is too large to put on the stack var s-ah/eax: (addr handle stream byte) <- address s-h populate-stream s-ah, 0x4000000 + draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, "loading data disk..", 3/fg 0/bg var _s/eax: (addr stream byte) <- lookup *s-ah var s/ebx: (addr stream byte) <- copy _s - load-sectors data-disk, 0/lba, 0x20000/sectors, s +#? load-sectors data-disk, 0/lba, 0x20000/sectors, s + load-sectors data-disk, 0/lba, 0x7000/sectors, s draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, "done", 3/fg 0/bg # parse global data structures out of the stream var users-h: (handle array user) @@ -86,9 +87,10 @@ fn parse in: (addr stream byte), users: (addr array user), channels: (addr array var done?/eax: boolean <- stream-empty? in compare done?, 0/false break-if-!= - set-cursor-position 0/screen, 0 0 + set-cursor-position 0/screen, 0x20 0x20 draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, user-idx, 3/fg 0/bg draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, item-idx, 4/fg 0/bg + clear-stream record parse-record in, record var user?/eax: boolean <- user-record? record {