debug: add some code to time the performance of get_totsize()

Don't activate this by passing --enable-debug.  Just remove the
relevant #ifdefs when you want to test the performance of changes
in the counting code.
master
Benno Schulenberg 2018-06-03 18:17:17 +02:00
parent 4e667bd048
commit 430d3bad7a
1 changed files with 7 additions and 0 deletions

View File

@ -465,8 +465,15 @@ void ingraft_buffer(filestruct *somebuffer)
}
#endif
#ifdef DEBUG
#include <time.h>
clock_t start = clock();
#endif
/* Add the number of characters in the copied text to the file size. */
openfile->totsize += get_totsize(openfile->fileage, openfile->filebot);
#ifdef DEBUG
statusline(ALERT, "Took: %.2f", (double)(clock() - start) / CLOCKS_PER_SEC);
#endif
/* If we pasted onto the first line of the edit window, the corresponding
* struct has been freed, so... point at the start of the copied text. */