English
Opportunities and suggestions

X11Beta6: between against case/if

 
i see something not! my Performancevergleich between Between and of/ one own function has yield the The Own function explicit faster operates.

I have Perhaps but too wrong tested! here my Test for Between (becomes by me 18.000 time worn out)
CompileMarkSeparation
var BALL.XS!=0
var BALL.YS!=0
var BALL.RS!=0
CLS
var TME&=&GETTICKCOUNT+3000
var C&=0

WHILE &GETTICKCOUNT<TME&

    C&=C&+1
    PERFPROC()

ENDWHILE

PRINT C&
WAITINPUT
END

proc PERFPROC

    BALL.XS!=RND(40)-20
    BALL.YS!=RND(40)-20
    RETURN RECTINTERSECT(BALL.XS!,BALL.YS!,100,100,50,50,200,200)

endproc

proc RECTINTERSECT

    PARAMETERS X!,Y!,XX!,YY!,XXX!,YYY!,XXXX!,YYYY!
    RETURN BETWEEN(X!,XXX!,XXXX!,Y!,XXX!,YYYY!) OR BETWEEN(XX!,XXX!,XXXX!,YY!,XXX!,YYYY!)

endproc


and here The faster Own Version (becomes by me 21.000 time worn out)
CompileMarkSeparation
var BALL.XS!=0
var BALL.YS!=0
var BALL.RS!=0
CLS
var TME&=&GETTICKCOUNT+3000
var C&=0

WHILE &GETTICKCOUNT<TME&

    C&=C&+1
    PERFPROC()

ENDWHILE

PRINT C&
WAITINPUT
END

proc PERFPROC

    BALL.XS!=RND(40)-20
    BALL.YS!=RND(40)-20
    RETURN RECTINTERSECT(BALL.XS!,BALL.YS!,100,100,50,50,200,200)

endproc

proc RECTINTERSECT

    PARAMETERS X!,Y!,XX!,YY!,XXX!,YYY!,XXXX!,YYYY!

    IF (XX!<XXX!) OR (X!>XXXX!)

        RETURN 0

    ENDIF

    IF (YY!<YYY!) OR (Y!>YYYY!)

        RETURN 0

    ENDIF

    RETURN 1

endproc


The faster Version has More XProfanzeilen, I had meant the Between in the or-Doppelpack nevertheless faster is.
 
11/22/07  
 



I see strain the
CompileMarkSeparation
proc RECTINTERSECT

    PARAMETERS X!,Y!,XX!,YY!,XXX!,YYY!,XXXX!,YYYY!
    RETURN BETWEEN(X!,XXX!,XXXX!,Y!,XXX!,YYYY!) OR BETWEEN(XX!,XXX!,XXXX!,YY!,XXX!,YYYY!)

endpr
anyhow wrong is, but the ought to in the reference on the Geschwindigkeitstest none Einfluss having.
 
11/23/07  
 




RGH
try it with the new function INTERSECT():
CompileMarkSeparation
var BALL# = new(xpRect)
BALL#.posx! = 0
BALL#.posy! = 0
BALL#.x! = 100
BALL#.y! = 100
var TEST# = new(xpRect)
TEST#.posx! = 50
TEST#.posy! = 50
TEST#.x! = 150
TEST#.y! = 150
CLS
var TME&=&GETTICKCOUNT+3000
var C&=0

WHILE &GETTICKCOUNT<TME&

    C&=C&+1
    PERFPROC()

ENDWHILE

PRINT C&
WAITINPUT
END

proc PERFPROC

    BALL#.posx! = RND(40)-20
    BALL#.posy! = RND(40)-20
    RETURN RECTINTERSECT(BALL#, TEST#)

endproc

proc RECTINTERSECT

    PARAMETERS X#, Y#

    IFNOT INTERSECT(r, X#, Y#)

        RETURN 0

    ENDIF

    RETURN 1

endproc


The letzer procedure is only because of the Vergleichbarkeit there. naturally would mach on these dispense and supra same INTERSECT(s, BALL#, TEST#) write, what The story again circa over 40% speed.
Greeting
Roland
 
Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4
11/24/07  
 




RGH
alas Yes: naturally would one with Bällen the structure xpSphere use:
CompileMarkSeparation
var BALL# = new(xpSphere)
BALL#.posx! = 0
BALL#.posy! = 0
BALL#.x! = 100
var TEST# = new(xpSphere)
TEST#.posx! = 50
TEST#.posy! = 50
TEST#.x! = 100
CLS
var TME&=&GETTICKCOUNT+3000
var C&=0

WHILE &GETTICKCOUNT<TME&

    C&=C&+1
    PERFPROC()

ENDWHILE

PRINT C&
WAITINPUT
END

proc PERFPROC

    BALL#.posx! = RND(40)-20
    BALL#.posy! = RND(40)-20
    RETURN INTERSECT(s, BALL#, TEST#)

endproc

 
Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4
11/24/07  
 




RGH
iF
i see something not! my Performancevergleich between Between and of/ one own function has yield the The Own function explicit faster operates.
The faster Version has More XProfanzeilen, I had meant the Between in the or-Doppelpack nevertheless faster is.


Hello iF,

what XProfan-intern a good deal Time uses, is the evaluate of Parameters, alike whether as Funktionsparameter in clinging or as procedure-Parameter with PARAMETERS. In Your example with BETWEEN there of it a stattliche amount More, as in the without (20 here and 8 there).
The benefit of BETWEEN is here the, that You really no Own Proztedur RECTINTERSECT More need and the Einzeiler directly bring into action can. already reduce the übergebenen Parameter of 20 on 12 ... and already is the whole twice so quick (though it still 4 Parameterübergaben More are):
CompileMarkSeparation
var BALL.XS!=0
var BALL.YS!=0
CLS
var TME&=&GETTICKCOUNT+3000
var C&=0

WHILE &GETTICKCOUNT<TME&

    C&=C&+1
    PERFPROC()

ENDWHILE

PRINT C&
WAITINPUT
END

proc PERFPROC

    BALL.XS!=RND(40)-20
    BALL.YS!=RND(40)-20
    RETURN BETWEEN(BALL.XS!,50,200,BALL.YS!,50,200) OR
    BETWEEN(100,50,200,100,50,200)

endproc


Greeting
Roland
 
Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4
11/24/07  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

2.389 Views

Untitledvor 0 min.
H.Brill09/24/23
holmol9305/30/13
Torben Nissen02/12/12
bastler01/17/11

Themeninformationen

this Topic has 2 subscriber:

RGH (3x)
iF (2x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie