TSynSQLSyn.TableNames slow when adding new strings #28

Closed
ansgarbecker opened this Issue May 10, 2016 · 5 comments

Projects

None yet

3 participants

@ansgarbecker

Users of HeidiSQL are experiencing slowness when HeidiSQL adds more than ~1000 strings to a TSynSQLSyn.TableNames. On my Core I7 4500U CPU, 1000 strings need roughly 1 second. A normal TStringList would work much faster, but SynEdit does something in the back with this list, which makes it so slow.

It also does not seem to have an effect if I wrap that in a BeginUpdate/EndUpdate block.

See the latest report from a user: http://www.heidisql.com/forum.php?t=18945#p21272

@Lajos-Juhasz

I noticed this bug yesterday. My solution was to build the list in the temporary stringlist and assign the complete list to the highlighter. Most probably the reason for the slowdown is the TSynSQLSyn.TableNamesChanged.

Maybe we should add BeginTableNamesUpdate/EndTableNameUpdates.

@ansgarbecker

I already wrapped the TableNames assignment in a Begin/EndUpdate block. Still, one update of that list is still slow.

I did some debugging and found out that it is TSynSQLSyn.PutTableNamesInKeywordList which is slow. Took ~15 seconds for 10,000 table names. To verify that I'm only once in PutTableNamesInKeywordList() I added a showmessage() there, which showed up once, so I'm very sure it's executed one time, not one time per item.

Only, in PutTableNamesInKeywordList() I see some HashKey logic of which know nothing about. Would be nice if someone could speed that procedure up for large amounts of table names.

@uschuster uschuster added a commit that referenced this issue Aug 14, 2016
@uschuster uschuster Fix for #28: Use TDictionary<Key, Value> for D2009 and newer to incre…
…ase the performance for adding a lot of table names

the used hash table with a 8-bit bucket size seems not designed for thousands of entries
19b66fd
@uschuster
Contributor

The used hash table with a 8-bit bucket size seems not designed for thousands of entries. I have committed a fix that uses TDictionary<Key, Value> for D2009 and newer to increase the performance.

@ansgarbecker

Looks very promising! Thanks so far.
I just merged the updated code in HeidiSQL so I get feedback from relevant users.

@ansgarbecker

Got positive feedback (along with more negative comments about totally unrelated stuff) here and here

Thanks a lot for fixing this. Was a long-time bug in Heidi, before I reported that here.

@zedfoxus zedfoxus pushed a commit to zedfoxus/heidisql that referenced this issue Aug 21, 2016
ansgarbecker Merge latest changes from official SynEdit repository. Fixes slow hig…
…hlighter when TableNames contains several 1000's of strings. Removes limitation to 1000 table names for highlighting. See

* http://www.heidisql.com/forum.php?t=16307
* SynEdit/SynEdit#28

git-svn-id: http://svn.code.sf.net/p/heidisql/code/trunk@5111 40cadd2d-89a2-4482-8f20-0232d845d7e3
227b9d1
@md2perpe md2perpe pushed a commit to HeidiSQL/HeidiSQL that referenced this issue Oct 9, 2016
ansgarbecker Merge latest changes from official SynEdit repository. Fixes slow hig…
…hlighter when TableNames contains several 1000's of strings. Removes limitation to 1000 table names for highlighting. See

* http://www.heidisql.com/forum.php?t=16307
* SynEdit/SynEdit#28

git-svn-id: http://svn.code.sf.net/p/heidisql/code/trunk@5111 40cadd2d-89a2-4482-8f20-0232d845d7e3
5f4ee35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment