[Github-comments] [geany/geany] Aggressively cache line height for computing margin sizes (b08ae0f)

elextr notifications at xxxxx
Fri Feb 5 12:32:00 UTC 2021


I missed the zoom/ascent/descent but still its only 4 ints.  

Why do you need prev + old ones? There are 5 values including font, you are comparing the current values to the set that your cached height meets to avoid re-calculating height.  There is only one compare for each hash calculation, so hashing gives no real benefit that I see since you do the hash calculation of the current values each time, hashes are good if you need lots of compares each time.  

To me:

```
font = sci_get_string(sci, SCI_STYLEGETFONT, 0);
size = SSM(sci, SCI_STYLEGETSIZEFRACTIONAL, 0, 0);
zoom = SSM(sci, SCI_GETZOOM, 0, 0);
descent = SSM(sci, SCI_GETEXTRADESCENT, 0, 0);
ascent = SSM(sci, SCI_GETEXTRAASCENT, 0, 0);
if(cached_size == size && cached_zoom == zoom && cached_descent = descent && cached_zoom == zoom && cached_ascent == ascent && strcmp(cached_font, font) == 0) ......
```

is clearer and guaranteed to be correct.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/commit/b08ae0fe65c0942dca20281d6841dc83406d8b5e#commitcomment-46786953
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20210205/76611602/attachment.htm>


More information about the Github-comments mailing list