View Issue Details

IDProjectCategoryView StatusLast Update
0000381Gameplay + OpenGL(No Category)public2017-03-04 18:50
ReporterMatthew the Glutton 
Assigned To 
PrioritylowSeveritytrivialReproducibilityhave not tried
Status resolvedResolutionno change required 
Summary0000381: Distance3D is much slower than (a.pos-b.pos).length()
DescriptionIn the below example, using .length() gives me about 1080 ms/frame, while using distance3d gives about 1800+ ms/frame.

Not a huge deal, just seems kinda pointless to have another actor function that, despite being simpler on its face, is much less efficient.
Steps To Reproduce
/*
vid_fps 1;summon cru;
vid_fps 1;summon fin;
*/

class Cru:Actor{
    int blah1;
    states{
    spawn:
        BAL1 A 1 nodelay{
            for(int i=0;i<1000000;i++){
                blah1+=(players[0].mo.pos-pos).length();
            }
        }wait;
    }
}
class Fin:Actor{
    int blah1;
    states{
    spawn:
        BAL1 A 1 nodelay{
            for(int i=0;i<1000000;i++){
                blah1+=distance3d(players[0].mo);
            }
        }wait;
    }
}
TagsNo tags attached.

Relationships

Activities

Graf Zahl

Graf Zahl

2017-03-04 17:38

administrator   ~0000866

That's because it is doing a lot more. It's also overhead from the function call.
Distance3D is a portal aware function and needs to check the portal table.
Matthew the Glutton

Matthew the Glutton

2017-03-04 18:50

reporter   ~0000867

Portals... I knew I forgot something!

Issue History

Date Modified Username Field Change
2017-03-04 17:27 Matthew the Glutton New Issue
2017-03-04 17:38 Graf Zahl Note Added: 0000866
2017-03-04 17:38 Graf Zahl Status new => resolved
2017-03-04 17:38 Graf Zahl Resolution open => no change required
2017-03-04 18:50 Matthew the Glutton Note Added: 0000867