Skip to content

Possible Optimizations

mermerico edited this page Sep 2, 2013 · 1 revision

Because filmulate() happens in the middle of the editing process, it is very important that it be as fast as possible in order to give responsive previews to the user. This wiki page documents what improvements are suggested to improve speed.

Things that haven't been tried yet

Do some of diffuse_x in place

When applying the blur to developer_concentration, we first copy a whole row into a vector, mirroring the edges of the row for padding. While it is useful to copy the areas that have mirroring (makes for better caching), copying the rest of the row is probably unnecessary and takes some (probably short) time. We could see how much speed we gain by diffusing most of the row in place, without copying it back and forth.

Combine matrices into a single matrix of structs

In develop(), many matrices have to be loaded and juggled around in cache. It may be more efficient if we had a matrix of structs where each struct had the crystal_radius and silver_salt_density for r,g, and b elements of a pixel. developer_concentration should probably be kept separate so that diffuse() does not have to load these elements into cache.

Things that have been tried but didn't work

Looping over R, G, and B in develop()

In develop() we write out similar processes for calculating crystal_radius and the like for each sub-element (RGB) of a pixel. When we tried putting these calculations in a loop instead, we saw a performance drop.

Clone this wiki locally