aeosynth/4chan-x — Issue #330: Investigate imgExpand.resize() performance
Author: MayhemYDG
Created: 2011-10-14 13:48:55+00:00
State: open

```
resize: ->
console.time "bench"
console.log innerHeight
console.timeEnd "bench"
```

>bench: 0 or 1ms

```
resize: ->
console.time "bench"
imgExpand.style.innerHTML = ".fitheight img[md5] + img {max-height:#{innerHeight}px;}"
console.timeEnd "bench"
```

>bench: ~300ms * how many resize events are triggered

With default AppChan:

>bench: ~1500ms * how many resize events are triggered

![](http://i.imgur.com/Q5jzv.png)

Style recalculation is what slows everything down.
Removing these three lines makes browsing much more responsive.

```
$.bind window, 'resize', imgExpand.resize
imgExpand.style = $.addStyle ''
imgExpand.resize()
```

Any ideas?