Performance Analyse
Übersicht

![]() |
Silver_KneeBetreff: Performance Analyse |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hey, ich versuche gerade ein Stück code zu analysieren.
Er wird in der Hauptschleife ausgeführt und unter Umständen sieht es nicht sehr rosig aus: Code: [AUSKLAPPEN] DebugLog:--BEGIN PHYSICS--
DebugLog:Frames: 7 DebugLog:Player movement: 0 DebugLog:Physics: 6 ms 7 frames DebugLog:Collisions: 170 DebugLog:Send Update: 1 DebugLog:--END PHYSICS: 257-- DebugLog:Mem: 5715664 DebugLog:--BEGIN PHYSICS-- DebugLog:Frames: 7 DebugLog:Player movement: 1 DebugLog:Physics: 6 ms 7 frames DebugLog:Collisions: 166 DebugLog:Send Update: 0 DebugLog:--END PHYSICS: 181-- DebugLog:Mem: 5715712 DebugLog:--BEGIN PHYSICS-- DebugLog:Frames: 7 DebugLog:Player movement: 0 DebugLog:Physics: 6 ms 7 frames DebugLog:Collisions: 163 DebugLog:Send Update: 0 DebugLog:--END PHYSICS: 170-- DebugLog:Mem: 5715664 DebugLog:--BEGIN PHYSICS-- DebugLog:Frames: 7 DebugLog:Player movement: 0 DebugLog:Physics: 6 ms 7 frames DebugLog:Collisions: 164 DebugLog:Send Update: 0 DebugLog:--END PHYSICS: 258-- DebugLog:Mem: 5715664 DebugLog:--BEGIN PHYSICS-- DebugLog:Frames: 6 DebugLog:Player movement: 0 DebugLog:Physics: 6 ms 6 frames DebugLog:Collisions: 167 DebugLog:Send Update: 0 DebugLog:--END PHYSICS: 1102-- DebugLog:Mem: 5715680 DebugLog:--BEGIN PHYSICS-- DebugLog:Frames: 7 DebugLog:Player movement: 0 DebugLog:Physics: 6 ms 7 frames DebugLog:Collisions: 166 DebugLog:Send Update: 1 DebugLog:--END PHYSICS: 277-- DebugLog:Mem: 5715664 DebugLog:--BEGIN PHYSICS-- DebugLog:Frames: 7 DebugLog:Player movement: 0 DebugLog:Physics: 6 ms 7 frames DebugLog:Collisions: 164 DebugLog:Send Update: 1 DebugLog:--END PHYSICS: 205-- DebugLog:Mem: 5715664 DebugLog:--BEGIN PHYSICS-- DebugLog:Frames: 6 DebugLog:Player movement: 0 DebugLog:Physics: 6 ms 6 frames DebugLog:Collisions: 165 DebugLog:Send Update: 0 DebugLog:--END PHYSICS: 517-- DebugLog:Mem: 5715664 DebugLog:--BEGIN PHYSICS-- DebugLog:Frames: 7 DebugLog:Player movement: 0 DebugLog:Physics: 6 ms 7 frames DebugLog:Collisions: 166 DebugLog:Send Update: 0 DebugLog:--END PHYSICS: 300-- DebugLog:Mem: 5715664 DebugLog:--BEGIN PHYSICS-- DebugLog:Frames: 7 DebugLog:Player movement: 0 DebugLog:Physics: 6 ms 7 frames DebugLog:Collisions: 164 DebugLog:Send Update: 1 DebugLog:--END PHYSICS: 4149-- DebugLog:Mem: 5715680 DebugLog:--BEGIN PHYSICS-- DebugLog:Frames: 7 DebugLog:Player movement: 0 DebugLog:Physics: 6 ms 7 frames DebugLog:Collisions: 166 DebugLog:Send Update: 0 DebugLog:--END PHYSICS: 256-- DebugLog:Mem: 5715712 DebugLog:--BEGIN PHYSICS-- DebugLog:Frames: 7 DebugLog:Player movement: 0 DebugLog:Physics: 8 ms 7 frames DebugLog:Collisions: 163 DebugLog:Send Update: 1 DebugLog:--END PHYSICS: 212-- DebugLog:Mem: 5715664 Die Teile "Player movement", "Physics", "Collisions" und "Send Updates" sind dabei fast alle Teile des Codes. Die Zeit addiert sich allerdings teilweise nicht auf. Ich zeig das mal: Hauptschleife BlitzMax: [AUSKLAPPEN] If TGame._instance And TGame._instance._selectedShip Phyiscs: BlitzMax: [AUSKLAPPEN] Function Physics() Ich habe also mit den time=Millisecs() und Debuglog "..."+(Millisecs() - time) eigentlich alles eingeklammert. Die Funktionsaufrufe und das eine If sollen zusammen mal vielleicht eine Millisekunde dauern. Von mir aus 10 aber da gibt es Runden in der Hauptschleife wie diese: Code: [AUSKLAPPEN] DebugLog:--BEGIN PHYSICS--
DebugLog:Frames: 7 DebugLog:Player movement: 0 DebugLog:Physics: 6 ms 7 frames DebugLog:Collisions: 164 DebugLog:Send Update: 1 DebugLog:--END PHYSICS: 4149-- Ich mein 171 ms in der Hauptschleife sind eh schon zu viel, aber wo kamen 3 Sekunden her, die da nicht geloggt wurden? |
||
![]() |
Silver_Knee |
![]() Antworten mit Zitat ![]() |
---|---|---|
Punkt vor Strich....
http://en.wikibooks.org/wiki/B...xpressions Code: [AUSKLAPPEN] DebugLog "--END PHYSICS: "+(MilliSecs() & $7fFFffFF-time)+"--"
Da wird - vor & gerechnet und das gibt ein ergebnis das manchmal relativ gut passt. Es müsste heißen: Code: [AUSKLAPPEN] DebugLog "--END PHYSICS: "+((MilliSecs() & $7fFFffFF)-time)+"--"
Manchmal sieht man das erst nachdem man einen Thread auf gemacht hat ![]() |
||
![]() |
DAK |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hehe^^ Wofür hast du das Vorzeichenwegtrimmen überhaupt drin? Das Vorzeichen sollte an dieser Stelle eigentlich egal sein, wegen dem Zweierkomplement. | ||
Gewinner der 6. und der 68. BlitzCodeCompo |
![]() |
Silver_Knee |
![]() Antworten mit Zitat ![]() |
---|---|---|
ja, richtig. Hab allerdings an einer Stelle eine time für was anderes verwendet und das dann überall hinkopiert. | ||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group