c++.announce - Backyard C++ Hotrodding
- Walter Bright (2/2) May 23 2006 is now up on:
- Sean Kelly (9/12) May 23 2006 Great stuff! I've only read the first page so far, but one thing caught...
- Walter Bright (3/18) May 23 2006 Only about two dozen people reviewed that article, and all missed it
- James Mansion (7/8) Jun 01 2006 Hmm. vptr is typically not at offset 0 if the base class is a POD. It ...
- Sean Kelly (9/18) Jun 01 2006 The tricks are useful in other ways though. For example, I work with a
- Walter Bright (4/12) Jun 01 2006 You do have to check that the vptr is in the right place, and adjust
is now up on: http://www.artima.com/cppsource/backyard.html
May 23 2006
Walter Bright wrote:is now up on: http://www.artima.com/cppsource/backyard.htmlGreat stuff! I've only read the first page so far, but one thing caught my eye. Change: "We can then define a dehydrated pointer as being odd, and a hydrated pointer as being 1." to: "We can then define a dehydrated pointer as being odd, and a hydrated pointer as being even." Sean
May 23 2006
Sean Kelly wrote:Walter Bright wrote:Only about two dozen people reviewed that article, and all missed it <g>. Thanks.is now up on: http://www.artima.com/cppsource/backyard.htmlGreat stuff! I've only read the first page so far, but one thing caught my eye. Change: "We can then define a dehydrated pointer as being odd, and a hydrated pointer as being 1." to: "We can then define a dehydrated pointer as being odd, and a hydrated pointer as being even."
May 23 2006
http://www.artima.com/cppsource/backyard.htmlHmm. vptr is typically not at offset 0 if the base class is a POD. It might be, depending on whether the compiler decides to change 'this' on the cast to base instead of just using an offset, but YMMV. I can't help thinking that if you replace your malloc with nedmalloc or PTMalloc3 then most people will get a bigger speed boost than they will by trying to play dirty at such a low level. James
Jun 01 2006
James Mansion wrote:The tricks are useful in other ways though. For example, I work with a piece of software whose "database" is a memory mapped file containing objects with modified vtbls. The result is screaming fast and isn't something that could be accomplished by other means. So I view this article more as a window to some of the evil (and sometimes useful) games one can play with C++ than as a template one should follow to increase performance in a typical application. Seanhttp://www.artima.com/cppsource/backyard.htmlHmm. vptr is typically not at offset 0 if the base class is a POD. It might be, depending on whether the compiler decides to change 'this' on the cast to base instead of just using an offset, but YMMV. I can't help thinking that if you replace your malloc with nedmalloc or PTMalloc3 then most people will get a bigger speed boost than they will by trying to play dirty at such a low level.
Jun 01 2006
James Mansion wrote:You do have to check that the vptr is in the right place, and adjust accordingly.http://www.artima.com/cppsource/backyard.htmlHmm. vptr is typically not at offset 0 if the base class is a POD. It might be, depending on whether the compiler decides to change 'this' on the cast to base instead of just using an offset, but YMMV.I can't help thinking that if you replace your malloc with nedmalloc or PTMalloc3 then most people will get a bigger speed boost than they will by trying to play dirty at such a low level.Why not do both and get double the speedup?
Jun 01 2006