0
\$\begingroup\$

I'm very new to this so please forgive the questions possibly ill-stated nature.

Firstly is this even a valid way to speedtest:

public function L1() {

        tree.x = 200;
        tree.y = 200;
        tree.healthPoints = 0;
        addChild(tree);
        var myTimer:Timer = new Timer(100,60);
        myTimer.addEventListener(TimerEvent.TIMER,someFunction);
        myTimer.start();
        addEventListener(Event.ENTER_FRAME, speedTest)

    }
    function someFunction(event:TimerEvent) {
        t++
    }
    public function speedTest (e:Event) {
        if (tree != null) {
            do { tree.healthPoints += 1; } 
            while (tree.healthPoints < 10000) ;
            tree.healthPoints = 0;
                trace (t);


        }
    }

Secondly: I want to actually speed-test the entire game somehow to check if adding new features or rewriting current features actually optimizes the game or not.

What are some ways to do this?

\$\endgroup\$
1
\$\begingroup\$

That doesn't seem like a very useful way to do it IMO. Any profiling methods should introduce a consistent overhead, but relying on the callbacks may reduce accuracy.

Try using the Date class. Or better yet, a legit profiler like The Miner

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.