jcs
/textview
/amendments
/40
Halve text slab and line group sizes to reduce initial memory footprint
jcs made amendment 40 over 2 years ago
--- textview.c Fri Oct 25 16:03:47 2024
+++ textview.c Fri Oct 25 16:20:30 2024
@@ -1280,6 +1280,10 @@ reload_chunk:
} else if (height > line->rect.bottom - line->rect.top)
line->rect.bottom = line->rect.bottom + height;
+ if (nline == USHRT_MAX) {
+ Debugger();
+ return false;
+ }
nline++;
chunk->end_line = nline;
chunk->end_right = tv->padding.left;
@@ -1315,7 +1319,7 @@ reload_chunk:
chunk->need_recalc = false;
}
-done_chunks:
+done_chunks:
tv->nlines = nline;
line = TVGetLine(tv, nline);
--- textview.h Fri Oct 25 15:15:07 2024
+++ textview.h Fri Oct 25 16:28:27 2024
@@ -115,7 +115,7 @@ struct TVRec {
Handle first_text_slab;
Handle last_text_slab;
-#define TV_TEXT_SLAB_SIZE (16 * 1024)
+#define TV_TEXT_SLAB_SIZE (8 * 1024)
unsigned long text_length;
unsigned long last_space;
@@ -125,8 +125,8 @@ struct TVRec {
TVChunkPtr first_chunk;
TVChunkPtr last_chunk;
- Handle line_groups[16];
-#define TV_LINE_GROUP_NLINES 1000
+ Handle line_groups[32];
+#define TV_LINE_GROUP_NLINES 500
#define TV_LINE_GROUP_SIZE (sizeof(struct TVLine) * TV_LINE_GROUP_NLINES)
unsigned short nlines;