Si j’exécute 2 fois le programme sans les supprimer, je constate que le temps mit par la deuxième instance est bien plus court

Constaté vous la même chose chez vous ?
Pourquoi la deuxième instance a mit moins de temps que la première !!!!???
Attention : Il est clair que les perfo dépendent grandement de la configuration de l’ordi.
Probablement qu’avec les conf actuelles, vous ne voyez rien, mais moi avec mon pauvre PIII 500 et Win98, je sens une nette différence : j’ai un facteur > 20 à 200!
C’est probablement un problème de gestion de mémoire.
Je ne sais pas dire si c’est Win98 ou PB que s’emmêle.
C’est très gênant pour la joueabilité de mon jeu à vrai dire

C’est surtout une situation intrinsèquement inextricable

Quelqu’un a une explication et un remède ?
Code : Tout sélectionner
InitSprite()
#Width=32
#Height=32
#WindowWidth=22*#Width
#WindowHeight=14*#Height
#NbDisplaySprite = #WindowWidth/#Width * #WindowHeight/#Height
#NbSprite = #NbDisplaySprite
If OpenWindow(0, 0, 0, #WindowWidth, #WindowHeight, #PB_Window_SystemMenu|#PB_Window_ScreenCentered, "Boxes") And OpenWindowedScreen(WindowID(), 0, 0, #WindowWidth, #WindowHeight, 0, 0, 0)
AddKeyboardShortcut(0,#PB_Shortcut_F1, #PB_Shortcut_F1)
For k = 0 To #NbSprite-1
CreateSprite(k, #Width, #Height, #PB_Sprite_Memory)
If StartDrawing(SpriteOutput(k)); Dessine le Sprite
y = 0
#StepX = 2
StepY = Round(#StepX*#Height/#Width, 0)
For x = 0 To #Width/2 Step #StepX
Box(x, y, #Width-2*x, #Height-2*y ,RGB(Random(255),Random(255),Random(255)))
y + StepY
Next x
;Locate(#Width/3, #Height/3) : DrawText(Str(k))
StopDrawing()
EndIf
Next
;Affichage des sprites
k=0
tps = GetTickCount_()
For x = 0 To #WindowWidth-1 Step #Width
For y= 0 To #WindowHeight-1 Step #Height
DisplaySprite(k, x, y)
DisplaySprite(k%#NbSprite, x, y)
k+1
Next
Next
tps = GetTickCount_() - tps
If StartDrawing( ScreenOutput() )
Locate( 0, 0)
DrawText( "TPS:"+Str(tps) )
StopDrawing()
EndIf
FlipBuffers()
Repeat
Until WindowEvent() = #PB_Event_CloseWindow
EndIf