Slashdot Mirror


User: richy+k

richy+k's activity in the archive.

Stories
0
Comments
2
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 2

  1. More insight into this research at... on Scientists Developing Commercially Viable Synthetic Gecko · · Score: 1

    This special kind of biomimetics is also being researched elsewhere, for example at the Max-Planck-Institute in Stuttgart, Germany. An insightful article can be downloaded from here.

  2. Re:Why C# can outperform C/C++ on After DeCSS, DVD Jon Releases DeDRMS · · Score: 1

    1) Record in the virtual machine/JIT every time a vector gets resized.
    2) Based on the pattern of resizing, speculatively allocate for new vectors/resizes as much memory as they'll ever need, or at least as much as they'll need any time soon.
    3) When you guess wrong about a speculative allocation, adjust your speculation.

    Very true, indeed. The only thing that is missing in this analysis is this: why can all this not be done with a static compiler when you design your class such as to record usage patterns and resize based on previous resizes?

    Well, the answer is: it can. You can design a class Vector<T> in C++ which behaves exactly the way you describe. The Holy Standard doesn't even demand allocation in powers of two. What you describe may even be the internal implementation of a perfectly valid std::vector<T>. If it hasn't been done already it is most likely because it is too clever. A simpler allocation in powers of two is extremely robust to worst cases caused by weird usage patterns.