Forum > Lazarus Extra Components

MPHexEditor, large files scrolling

(1/4) > >>

DIMM_bl4:
Hello to all, my first message here.
Have a some trouble with MPHexEditor module, when open large files scrolling became very slow. This is slightly noticeable from 16-32MB size and go worst with increasing size.
First of all, I go to example project, and see exactly the same.
Lazarus is 2.0.10, FPC 3.2.0, MPHexEditor from here https://github.com/michalgw/mphexeditor

I tried to solve by myself, but looks like I'm not strong enough )
Found that things:
There are used two ways for scrolling
1. Scroll with keyboard/mousewheel do with changing of 'TopRow' property, and this way is slow.
2. Scroll with side scrollbar is totally differrent and uses 'WMHScroll(var message: TLMHScroll)' and then 'TrySmoothScrollBy(Col, Row)' from module Grids. This way work always fast, with any file size.

Would appreciate any help, or thoughts )

korba812:
This is a known issue. The problem is with TCustomGrid, from which TMPHexEdit inherits. I have attached a sample project to illustrate the problem. Other problems with using TCustomGrid are excessive memory consumption and row limit.
This is the main reason why I stopped further development of TMPHexEdit. It should probably be redesigned from scratch.

DIMM_bl4:
Thanks for reply.
I made a 'temporary' solution - modified procedures KeyDown, DoMouseWheelDown, DoMouseWheelUp from MPHexEditor.pas to also use TrySmoothScrollBy(aCol, aRow) from module Grids (as a scrollbar scrolling).
But for this I had to also modify module Grids.pas, for possibility to call TrySmoothScrollBy from outside. I moved it from 'private' declaration to 'protected', same as for some procedures, called from outside.
I'm not 100% sure about any side effects, but looks like working good.
I attach modified example .exe from MPHexEditor, now it can scrolls up to ~512MBytes files, original example freezed to death (with 100% load to one thread) with constant scrolling at about 32Mbytes files.
https://yadi.sk/d/7LU_sUxo1Zvk2Q


--- Quote from: korba812 on February 02, 2021, 06:35:19 pm ---The problem is with TCustomGrid, from which TMPHexEdit inherits ...

--- End quote ---
I can not totally agree, because I also tryed to use 'parent' versions of procedures DoMouseWheelDown, DoMouseWheelUp, and scrolling became fast (no freeze)...but at one line per wheel's 'tick'.

korba812:
IMHO, a better solution will be to expand functionality of TCustomGrid component. The TCustomGrid.UpdateCachedSizes method is called quite often. This function sums height of all rows, so it takes a while for a large number of rows. In many cases, all rows have the same height and there is no point in storing it. I would suggest adding a mode where all rows (or at least non-fixed) have the same height and not store their height values. This will eliminate the problem with slowdown and high memory consumption.

Mastropiero:
Hello,

first of all, sorry for the thread necromancy.

I have recently faced this issue. It seems that the problem has been inherited from TCustomGrid. Is there any chance of having someday a new version of this component that is not based on TCustomGrid so the problem does not exist anymore?

Could the MPHexEditor component be redesigned so it only handles the rows that are actually shown on the screen instead of loading the whole file into RAM?

Navigation

[0] Message Index

[#] Next page

Go to full version