Re: casting PositionNormalColored[] to byte[]

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Thanks for you're quick responses.

I think that you're right about the premature optimization is a bad
thing. And that I indeed should focus on making it work. But it was
just something I couldn't realize in C#, and I don't like that.


Stephan Rose schreef:

On 2 Aug 2006 03:13:29 -0700, flopturnriver@xxxxxxxxx wrote:

My first solution did indeed copy individually vertices to the buffer.
After that i did made that subset and passed it at once to the buffer.
That did made it much faster. But I want more... more FPS... ;-). And
because the copy is a performance penalty...

But isn't it possible with unsafe code? Because, in c++ terms, is see
that pncs is just a pointer to the beginning of an array of structures.

So why can't i make an byte[] pointer that has the same address?


Oh, why didn't they made the buffer.Write(PositionNormalColored[]
value, int offset, int count)!!!


Copying an array with 350 vertices is rather insignificant
performance-wise. If you want to avoid the Copy then structure your
data in such a way that you don't need to copy.

Also remember, premature optimization is not a good thing! Write your
engine, get it functional, then identify your bottlenecks and worry
about optimizing the things that truly need it.

.



Relevant Pages

  • Re: casting PositionNormalColored[] to byte[]
    ... that pncs is just a pointer to the beginning of an array of structures. ... value, int offset, int count)!!! ... premature optimization is not a good thing! ...
    (microsoft.public.win32.programmer.directx.managed)
  • Re: return return new int[] { pounds, shilings, pence}; to main
    ... >> The function can then load this parameter directly or create a temporary ... > I would call that premature optimization, ... NRVO cannot be used effectively ... std::vectorarray; ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Quick way to initialize array with all zeros
    ... array and need to reinitialize it to zero, ... Premature optimization ... for code clarity. ...
    (comp.lang.java.programmer)
  • Re: struct by value
    ... If you mean that scalar types (i.e., numeric and pointer types) ... should be passed by value and other types (arrays, structs, unions) ... thinking about that is time not spent on domain-level thinking, ... Going to the effort of passing by pointer is more like a premature optimization. ...
    (comp.lang.c)