diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-06-02 16:29:18 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-06-02 16:29:18 -0700 |
commit | 477216a0517671f4a5e34f4e66061898f22665c3 (patch) | |
tree | 1aac31fead8bda49692d1e2953f628e1b62c12a3 | |
parent | b4e76eac4e4773d2f4a46bd5ced7c22d8ffc8b15 (diff) | |
download | text.love-477216a0517671f4a5e34f4e66061898f22665c3.tar.gz |
this implementation undo load-tests quite poorly
Even a 10KB file gets sluggish within the first 1k characters inserted. We're not running out of memory, we're just overloading Lua's GC.
-rw-r--r-- | text.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/text.lua b/text.lua index b35de4e..05d9f35 100644 --- a/text.lua +++ b/text.lua @@ -1170,6 +1170,34 @@ function test_undo_delete_text() App.screen.check(y, 'xyz', 'F - test_undo_delete_text/screen:3') end +function test_zzz_undo_load_test() + print('\n\nTesting a 10KB file') + -- create a large list of lines + local lines = {} + -- 10k characters, hundred lines, 2k words + for i=1,100 do + local line = '' + for c=1,20 do + line = line..'abcd ' + end + end + Lines = load_array(lines) + -- perform 1000 mutations + print('are the dots printing quickly and without any pauses?') + for i=1,1000 do + if i%50 == 0 then + App.run_after_keychord('return') + else + App.run_after_textinput('a') + end + if i%10 == 0 then + io.write(i) + io.write(' ') + io.flush() + end + end +end + function Text.compute_fragments(line, line_width) --? print('compute_fragments', line_width) line.fragments = {} |