r888888888/danbooru — pull request #1543 by zatchii (2013-05-05 03:07:55+00:00)
Title: Fixes to note rendering

Some fixes to speed up note rendering. Related to issue #879.

The two main speedups are from loading notes to a document fragment and adding them all at once, and from avoiding an element query in scale() by storing the original size in the note box.

The call to resize() is delayed until the note body is first displayed.

With these fixes, [post #1335615](https://danbooru.donmai.us/posts/1335615) loads in about 6 seconds for me in Opera.

I did some quick and dirty profiling to find out where the remaining time is spent.
From a call to load_all in Opera:
* total 5542
* Note.add 5121
* Note.Box.create 2593
* $().draggable 522
* $().resizable 1315
* Note.Box.bind_events 262
* Note.Body.create 1190
* Note.Body.bind_events 975
* Note.Box.scale 853
* Note.Box.resize_inner_border 369
* Note.Body.display_text 121
* $().css 397
* $().data 704
* $().html 72