[Geany-devel] editing big files can be too slow with tag reparsing

Colomban Wendling lists.ban at xxxxx
Sat Sep 24 10:58:36 UTC 2011


Le 23/09/2011 19:48, Thomas Martitz a écrit :
> Am 22.09.2011 18:30, schrieb Nick Treleaven:
>> Hi,
>> Whilst opening doc/geany.html I found it takes >5s on my machine to
>> load. It's a big document though, still perhaps the HTML tag parser
>> performance could be improved.
>>
>> But now we have tag reparsing, editing geany.html becomes painful. I
>> know we can disable reparsing, but what else could we do to improve
>> the situation? It's not urgent to solve this problem, unless we want
>> to make reparsing off by default.
> 
> 
> How about automagically disabling auto-reparsing per-file if it takes
> too long (1s?) at runtime? Without needing to change the setting that is.

I like the idea.

Having a per-document setting (enabled/disabled) that would be
automagically turned off if a configured performance impact is reached
would probably be a correct compromise.

Something like:

(arbitrary values)
max-reparse-duration: 500ms
max-reparse-duration-exceeding: 3

if (reparse_duration >= max_reparse_duration) {
	/* give heavier weight to failures */
	doc->n_reparse_duration_exceeding += 2;
	if (doc->n_reparse_duration_exceeding >=
	    (max_reparse_duration_exceeding * 2)) {
		doc->real_time_reparse = FALSE;
	}
} else {
	/* give lighter weight to success */
	doc->n_reparse_duration_exceeding -= 1;
}

max-reparse-duration-exceeding is useful not to suffer of
false-positives like a reparsing happening when the machine is under
heavy load or any other temporary problem.  And it is always possible to
set it to <= 1 to disable that heuristic.

Opinions, ideas?

Regards,
Colomban



More information about the Devel mailing list