Cell commenting performance
Thursday, 8th February, 2007I never like to guess on performance, its been proven many many times that devs are rubbish at finding performance bottle necks and fixing them. The only valid approach is to test, so I have done some testing on our commenting discussion.
I used a workbook with 57k formulas and calced it 100 times in VBA.
Heres the results:
| calc times | seconds | % of Orig | NR effect |
| Original - no comments | 5 | ||
| Choose using cell address - return calc | 8 | 160% | |
| Choose using cell address - return comment 1 | 6 | 120% | |
| Choose using cell address - return comment 2 | 7 | 140% | |
| Choose using named range - return calc | 11 | 220% | 138% |
| Choose using named range - return comment 1 | 8 | 160% | 133% |
| Choose using named range - return comment 2 | 9 | 180% | 129% |
| Adding +N(”some comment…”) | 6 | 120% |
So using choose could virtually double the calc time, I’m surprised its so expensive. I’m sure a UDF specifically for this purpose could be made significantly faster.
The biggest surprise though is the effect of using a named range, not only does it slow calc time down by 30% but it also bloated the file from 8mb to 11.
Interestingly adding N() with about a 30 character string only slowed things down by 20% (longer strings were worse), and thats using it on all 57,000. On that basis I think occasional use of N() would have no noticeable impact on performance.
I can’t see me ever using it in something I build, but for emergency sticky tape repairs of other peoples stuff, I can totally imagine using it to minimise changed cells.
I used the VBA code at codematic for the timer
anyone got a better approach? Having heard from Charles Williams over at Decision Models (Fast Excel) that whether the calc gets triggered from Excel or from VBA has a massive impact on performance, I wonder if my timer code is a bit too blunt. Maybe its ok for rough stuff?
cheers
Simon
