Announcement

Collapse
No announcement yet.

Which is faster? (PBDLL or PBCC)?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Which is faster? (PBDLL or PBCC)?

    If you run these two code segments, you will see that PB/DLL is doing the test in 3/4 the time that PB/CC does...

    I would have thought it was the other way around....

    PBCC: 8.67 seconds
    PBDLL: 5.78


    Code:
    PBDLL
    '
    #Compile Exe
    #Include "win32api.inc"
    Function PbMain () As Long
    Local lTimer As Double
    SetPriorityClass GetCurrentProcess, %HIGH_PRIORITY_CLASS  'To speed things up a bit
    lTimer = Timer
    ! mov eax, 1000000000
    deceax:
    ! dec eax
    ! jne deceax
    Msgbox "Elapsed time: " + Str$(Timer - lTimer) + " seconds"
    End Function
    
    'PBCC
    '
    #Compile Exe
    #Include "win32api.inc"
    Function PbMain () As Long
    Local lTimer As Double
    SetPriorityClass GetCurrentProcess, %HIGH_PRIORITY_CLASS  'To speed things up a bit
    lTimer = Timer
    ! mov eax, 1000000000
    deceax:
    ! dec eax
    ! jne deceax
    StdOut "Elapsed time: " + Str$(Timer - lTimer) + " seconds"
    End Function


    ------------------
    Scott
    mailto:[email protected][email protected]</A>
    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

  • #2
    Scott,
    I think could it be a case of console loading times?



    ------------------
    Kev G Peel
    KGP Software, Bridgwater, UK.
    www.go.to/kgpsoftware
    kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

    Comment


    • #3
      Scott,

      If you add a print or stdout command to the pb/cc code (BEFORE the SetPriorityClass statement) then both are equal.
      It seems that the console handle is opened at the first console command.
      So the SetPriorityClass didn't work in the PB/CC example.


      ------------------
      Peter.
      mailto[email protected][email protected]</A>
      Regards,
      Peter

      "Simplicity is a prerequisite for reliability"

      Comment


      • #4
        Scott,

        From all of my own test code and from the technical data from PowerBASIC
        that I have seen over time, its the same machine under the hood so the
        performance should be much the same. I think Peter has a very good point
        and all I would add to that is to put the test code in each example into
        a function or sub and get the initialisation code complete for both before
        running the test.

        Regards,

        [email protected]

        ------------------
        hutch at movsd dot com
        The MASM Forum - SLL Modules and PB Libraries

        http://www.masm32.com/board/index.php?board=69.0

        Comment

        Working...
        X