Results 1 to 10 of 25

Thread: CLASS vs. OBJECT and memory management

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Quote Originally Posted by turrican View Post
    Here is a little benchmark for Delphi I did.

    https://github.com/turric4n/Delphi-B...jectsVSRecords

    Records are more faster than Heap allocated Records (Pointer to Records) and much more faster than Objects.
    It's tricky, I have similar tests and results depends on:
    1) How many records/objects exists
    2) Complexity of record/object (number or variables)
    The results will be completely different with:
    Code:
      TSpriteRec = record
        ID         : integer;
        x, y    : integer;
        Name    : String[80];
        angle     : double;
        alpha     : byte;
        components : array [0..9] of integer;
        p          : pointer;
      end;
    3) If features like sorting are needed

    In general array of pointers is fastest.
    Attached Files Attached Files
    Last edited by JC_; 15-07-2017 at 11:29 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
  •