Recent

Author Topic: How do TSynEdit and TMemo handle very large amounts of text?  (Read 1160 times)

vfclists

  • Hero Member
  • *****
  • Posts: 1147
    • HowTos Considered Harmful?
It all depends on how much is large, but how many megabytes or gigabytes is large for the text editing controls in Lazarus, and at what point are they mapped to disk to avoid memory running out (if that is done at all) ?
Lazarus 3.0/FPC 3.2.2

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11181
  • Debugger - SynEdit - and more
    • wiki
Re: How do TSynEdit and TMemo handle very large amounts of text?
« Reply #1 on: May 11, 2015, 08:37:46 pm »
TSynEdit has no build in for this. It relies on the OS swapping.
It is also restricted by widely using Integer as index (eg. for line number)

It also will not be very efficient with swapping, as there are some actions that need to scan the whole file:
- length of the longest line. (needed for horizontal scrollbar)
  done once at the start, then cached
  if cached line is edited => full scan.
- certain highlighter ops. e.g. starting a comment at the top of file, rescans to end of file, if no comment close is found (yes can be improved... some day)


It would be possible to replace parts of synedit, to deal with such files, but it might be quite some work. Ignoring HL, it might just be the textbuffer and its wrappers.


 

TinyPortal © 2005-2018