patrickfuller / imolecule

An embeddable webGL molecule viewer and file format converter.
http://patrickfuller.github.io/imolecule/
MIT License
86 stars 18 forks source link

Feature/animation loop optimization #8

Closed bjonnh closed 9 years ago

bjonnh commented 9 years ago

Allows me to get from 30fps to 50fps. And significantly reduce lag and CPU usaqe on notebooks containing >10 molecules.

You can give it a try to see if it also improves for you.

patrickfuller commented 9 years ago

Makes sense to me - I'll look at it in more detail tomorrow.

If you're interested in performance, there is a significantly larger upgrade that helps. My merged-geometry branch is a huge performance boost on larger molecules (ref). I ended up not implementing it because I wasn't concerned with performance at the time. Might be worth dusting off.

patrickfuller commented 9 years ago

One minor bug: the current code will mess up on window resize:

You need to add self.render() into $(window).resize (line 46) to work.

bjonnh commented 9 years ago

Corrected all of that. Thanks. I'm thinking about the merge-geometry. The patch cannot be applied as is as many things changed since. I was thinking about an optional geometry merge as some people may want to move the atoms (being able to see the bend, torsion related to an IR spectrum or whatever you can imagine). I'll try to work on that as soon as this one gets done.

patrickfuller commented 9 years ago

Looks good to me!

Thinking back to it, I had the same thoughts on merging geometry. You sacrifice functionality for performance, and you additionally increase the initial load time. It's worth keeping in mind if you're performance limited, but probably not needed in standard usage.