Results 1 to 8 of 8

Thread: [SOLVED]Strange misterious load time using FPC

  1. #1

    [SOLVED]Strange misterious load time using FPC

    [pascal]
    procedure GameINIT(const Size, bombs: Word);
    var
    a, b: Cardinal;
    begin
    a := GetTickCount;
    BASSinit;
    SDLinit; // SDL loaded, icon loaded and screen initialized here
    minefield := TMineField.create(Size, bombs);
    Loadresources; // files loaded from zip here

    b := GetTickCount;

    minefield.create2;

    Writeln(Format('%ums for minefield create2', [GetTickCount - b]));

    b := GetTickCount;

    font := Tbitmapfont.Create('font\monospac821a.xml');

    Writeln(Format('%ums for font loading', [GetTickCount - b]));

    Writeln(Format('%ums to gameINIT', [GetTickCount - a]));
    end;

    //...
    GameINIT(15, 40);
    //...[/pascal]

    Compiled with FPC 2.2.0


    Compiled with D7


    Game including a bin from FPC and D7 here ~550kb

    Look the HUGE misterious load time :? :?

    This is a study game, im making it for learning {i already learned a lot},
    i will try make it multiplayer

    A very test release and
    don't expect good graphics yet
    From brazil (:

    Pascal pownz!

  2. #2

    [SOLVED]Strange misterious load time using FPC

    Is the speed difference the same (or nearly same) every time you run those 2 executables? If yes then there can be 3 culprits - LoadResources, Writeln and Format.

  3. #3

    [SOLVED]Strange misterious load time using FPC

    Quote Originally Posted by Setharian
    Is the speed difference the same (or nearly same) every time you run those 2 executables? If yes then there can be 3 culprits - LoadResources, Writeln and Format.
    Yes, the speed is similar in every run

    Removed the lines and program still vry slow to load ;/
    From brazil (:

    Pascal pownz!

  4. #4

    [SOLVED]Strange misterious load time using FPC

    There's also "TMineField.Create(Size, bombs)" statement but I don't think it would cause such a delay (depends on the contents of the constructor). Just time every statement with GetTickCount and you'll find out which statement is so much slower with FPC.

  5. #5

    [SOLVED]Strange misterious load time using FPC

    Quote Originally Posted by Setharian
    There's also "TMineField.Create(Size, bombs)" statement but I don't think it would cause such a delay (depends on the contents of the constructor). Just time every statement with GetTickCount and you'll find out which statement is so much slower with FPC.
    Yeah you have reason the huge load time is on TMineField.Create,

    i will time the constructor to see what is making this
    From brazil (:

    Pascal pownz!

  6. #6

    [SOLVED]Strange misterious load time using FPC

    Solved

    The problem is many calls Randomize; that is extremelly slow on FPC.
    now only one call :?
    From brazil (:

    Pascal pownz!

  7. #7

    [SOLVED]Strange misterious load time using FPC

    Huh, strange. It might be faster to save the random seed, change it to the UTC time (as a longword) and then modify that number by a random integer.

  8. #8

    [SOLVED]Strange misterious load time using FPC

    Quote Originally Posted by Robert Kosek
    Huh, strange. It might be faster to save the random seed, change it to the UTC time (as a longword) and then modify that number by a random integer.
    thx i used google and found some info,
    im using this way
    [pascal]DecodeTime(Time,seed,seed,seed,seed);
    RandSeed := seed;[/pascal]

    tnx for all
    From brazil (:

    Pascal pownz!

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
  •