Results 1 to 10 of 38

Thread: PGD - Some thoughts about the future

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    PGDCE Developer de_jean_7777's Avatar
    Join Date
    Nov 2006
    Location
    Bosnia and Herzegovina (Herzegovina)
    Posts
    287
    Afaik dynamic arrays will only double in size only if you try to resize them. And it's existing size + new size. Resize will allocate new memory, copy over data and free the previous memory. In case the new size is smaller it is possible no reallocation will occur. Does not take up double memory, just the difference between new and old size, with a temporary need for additional memory while the array is reallocated. It does lead to memory fragmentation more easily. Also, the same will happen if you use a pointer to an array, and re-allocate the memory yourself. The same process happens, and dynamic arrays should not be that much slower than manual memory management. With dynamic arrays the compiler manages the memory and there is a small overhead (reference counting and what not). In any case, best to do as little resizing as possible. An idea for a benchmark.
    Existence is pain

  2. #2
    Memory management is not a problem. There was something else... but now I can see only speed down when Range Check error is enabled(and this is normal). So, there is one more reason to update my engine ) And I changed my mind a bit about Pascal compilers But I didn't test 64-bit version yet, e.g. FPC generates more instructions when there is a code using dynamic arrays, maybe there was something not optimal for 64-bit.

    update: Oh, now I remember, there were problems with throwing data via arrays between dll and application, and supporting C/C++. With time everything can be forgotten
    Last edited by Andru; 26-04-2014 at 10:54 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •