Closed emmericp closed 1 month ago
The purpose of calling delay is to give the program a chance to respond promptly to user actions. Perhaps using a time-based calculation would be better (but it might incur higher overhead for obtaining the time, which needs to be tested).
I understand the idea behind the rescheduling, but it just happens too often. Especially redundant-value
and trailing-space
are way too aggressive, there is no reason to reschedule after every single line or every single token. I considered using a time-based approach, but I was hesitant to use os.clock()
because it is heavily system-dependent and not exactly accurate. Even if it was time-based then checking the time for every single line/token is a bit much
These 5 diagnostics cause ~70% of all calls to await.delay() by diagnostics which in turn is about ~20% of the total runtime of diagnostics.
Out of these diagnostics only assign-type-mismatch commonly exceeds runtimes of 100ms (worst observed in my dataset was 7 seconds) and even then it still attempts to call await.delay() over 1500 times per second, so throttling by a factor of 15 is still fine.
There are likely more places where await() could be optimized, but the diagnostics are the low-hanging fruit because they are easy to find.