Buchempfehlung
Windows-Programmierung. Das Entwicklerhandbuch zur WIN32-API
Windows-Programmierung. Das Entwicklerhandbuch zur WIN32-API
"Der" Petzold, das über 1000 Seiten starke Standardwerk zum Win32-API - besonders nützlich u. a. bei der GUI-Programmierung in FreeBASIC! [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

fb:porticula NoPaste

Info
Info / Hilfe
Liste
Übersicht / Liste
Neu
Datei hochladen
Suche
Quellcode suchen
Download
Dateidownload

byref langsamer als byval?

Uploader:Mitgliedfrebas
Datum/Zeit:15.03.2010 21:36:37

Dim As UInteger a
Declare Sub sByVal(ByVal b As UInteger)
Declare Sub sByref(ByRef b As UInteger)
Dim As Double tmr
tmr=Timer

Sleep 15,1

For tempui As UInteger = 1 To 100000000
    sByVal(tempui)
Next
Print "byval: "+STR(Timer-tmr)
Sleep 150,1
For tempui As UInteger = 1 To 100000000
    sByVal(tempui)
Next
Print "byval: "+STR(Timer-tmr)
Sleep 150,1
For tempui As UInteger = 1 To 100000000
    sByVal(tempui)
Next
Print "byval: "+STR(Timer-tmr)
Sleep 150,1
For tempui As UInteger = 1 To 100000000
    sByVal(tempui)
Next
Print "byval: "+STR(Timer-tmr)
Sleep 150,1
For tempui As UInteger = 1 To 100000000
    sByVal(tempui)
Next
Print "byval: "+STR(Timer-tmr)
Print " "
Sleep 150,1
For tempui As UInteger = 1 To 100000000
    sByRef(tempui)
Next
Print "byref: "+Str(Timer-tmr)
Sleep 150,1
For tempui As UInteger = 1 To 100000000
    sByRef(tempui)
Next
Print "byref: "+Str(Timer-tmr)
Sleep 150,1
For tempui As UInteger = 1 To 100000000
    sByRef(tempui)
Next
Print "byref: "+Str(Timer-tmr)
Sleep 150,1
For tempui As UInteger = 1 To 100000000
    sByRef(tempui)
Next
Print "byref: "+Str(Timer-tmr)
Sleep 150,1
For tempui As UInteger = 1 To 100000000
    sByRef(tempui)
Next
Print "byref: "+Str(Timer-tmr)
Sleep 150,1
Print " "

For tempui As UInteger = 1 To 100000000
    sByVal(tempui)
Next
Print "byval: "+STR(Timer-tmr)
Sleep 150,1
For tempui As UInteger = 1 To 100000000
    sByVal(tempui)
Next
Print "byval: "+STR(Timer-tmr)
Sleep 150,1
For tempui As UInteger = 1 To 100000000
    sByVal(tempui)
Next
Print "byval: "+STR(Timer-tmr)
Sleep 150,1
For tempui As UInteger = 1 To 100000000
    sByVal(tempui)
Next
Print "byval: "+STR(Timer-tmr)
Sleep 150,1
For tempui As UInteger = 1 To 100000000
    sByVal(tempui)
Next
Print "byval: "+STR(Timer-tmr)
Print " "
Sleep 150,1
For tempui As UInteger = 1 To 100000000
    sByRef(tempui)
Next
Print "byref: "+Str(Timer-tmr)
Sleep 150,1
For tempui As UInteger = 1 To 100000000
    sByRef(tempui)
Next
Print "byref: "+Str(Timer-tmr)
Sleep 150,1
For tempui As UInteger = 1 To 100000000
    sByRef(tempui)
Next
Print "byref: "+Str(Timer-tmr)
Sleep 150,1
For tempui As UInteger = 1 To 100000000
    sByRef(tempui)
Next
Print "byref: "+Str(Timer-tmr)
Sleep 150,1
For tempui As UInteger = 1 To 100000000
    sByRef(tempui)
Next
Print "byref: "+Str(Timer-tmr)
Sleep 150,1


SLEEP




Sub sByVal(ByVal b As UInteger)
    Dim c As UInteger
    c=b+c
End Sub


Sub sByRef(Byref b As UInteger)
    Dim c As UInteger
    c=b+c
End Sub