Canvas 3d JS Library

where 3D is born!
  • rss
  • What is C3DL?
  • Download
  • Tutorials
    • Tutorial #1: Installing Canvas 3D Addon
    • Tutorial #2: A Scene and a Cube
    • Tutorial #3: Update Callback
    • Tutorial #4: Models 101
  • Development News
  • Demos
    • Typing Game V2.1
    • Typing Game V3 (0.3 Release)
    • Explorer
    • Flickr - Picking
    • Ricochet
    • FSOSS Pictures
    • Puzzler
  • Resources
  • Contact
  • About

More memory usage improvements

Andrew Smith | 1 October, 2008 | 19:31
Fiddled with memory some more. Basically all my fixes have been: getting local variables and memory allocations out of functions that are called in the update/render loop. The savings are significant - the 100 spinning teapots used 6MB/sec last week and only 1.4MB/sec now. That’s more than 60% better. Of course that’s not a lot if one were expecting orders of magnitude. This can actualy be taken down to almost nothing (in relative terms). And I’ll tell you how, but I won’t do it myself. The function Matrix::multiplyMatrixByVector() is called in the update loop. It allocates a vector, and returns it. That replaces the primitive’s left/up/dir/pos via the rotateOnAxis() function, which in other words is a malloc/free loop with a lot of horrible memory consuming abstraction around it. I tried fixing it in the same way I fixed the rest of the stuff - added a dest parameter to multiplyMatrixByVector(), and put the results in there. It didn’t work. Why it didn’t work I can’t tell you, I can’t explain the bhaviour I’m seing. Symptoms range (depending on implementation) from a stream of warnings about zero-length vectors to ‘dest is undefined’ javascript errors in the console. Whomever wants to give this a shot - what you need to do is replace this: this.dir = multiplyMatrixByVector(rotateOnAxisMat, this.dir); whith this: multiplyMatrixByVector(rotateOnAxisMat, this.dir, this.dir); in Primitive::rotateOnAxis(). Yes, I noticed it’s the same variable, and I know it’s passed by reference. I couldn’t find a reason that should be a problem.
Categories
c3dl development
Comments rss
Comments rss

« Canvas3D crashes in tracemonkey Tracemonkey performance »

Leave a comment

You can use these tags : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Search

Demos

  • Explorer
  • Flickr - Picking
  • FSOSS Pictures
  • Puzzler
  • Ricochet
  • Typing Game V2.1
  • Typing Game V3 (0.3 Release)

C3DL Development News

Bounding Boxes on Collada Objects

I ran into a nasty bug that has left me scratching my head recently. It involved taking the work Patrick has done on picking, more specifically his bounding box code and integrating it with Collada objects. It seemed pretty straightforward when I first started working on it, but I have had little success. [...]

A hair away…

Alas, I have approached the summit. With my hands, I have created a Mac application, which runs, and has the customized chrome interface. This alone is an incredible feat for me, since I rarely create GUI-based programs, and I certainly haven’t developed them on a Mac before. The only problem is that the canvas element [...]

Tutorials

  • Tutorial #1: Installing Canvas 3D Addon
  • Tutorial #2: A Scene and a Cube
  • Tutorial #3: Update Callback
  • Tutorial #4: Models 101

Archives

C3DL Development News

Recent Comments

  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • June 2008
  • May 2008
  • April 2008
  • March 2008
  • February 2008
  • January 2008
  • December 2007
  • Bounding Boxes on Collada Objects
  • A hair away…
  • Particle Systems
  • Welcome aboard
  • C3DL Namespace refactoring
  • Library Changes
  • Portable Canvas v0.2!
  • Namespaces and const
  • DAE Scenegraph
  • The Matrix Stack
  • That is absolutely a... - Cathy
  • I'm not so certain t... - Cathy Leung
  • For name spaces, my... - Jeremy Giberson
  • Great! Really really... - Edson Mattos
  • Beautiful!... - Funtomas
  • Was no need to conta... - Andrew Smith
  • Andrew, have you con... - Funtomas
  • Thanks for posting t... - Andrew Smith
  • Vlad was in town and... - Cathy Leung
  • the upside down issu... - Cathy Leung



Canvas 3d JS Library

©2007- 2008 Canvas 3d JS Library

Disclaimer: This website is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 Canada License.
The Canvas 3d JS Library and Demos found on this website are licenced under the MIT License

Creative Commons License