#script_execute_ext vs function call (draw_sprite)

1 messages · Page 1 of 1 (latest)

solar estuary
#
    new Benchmark("script_execute_ext vs function call", [
        new TestCase("script_execute_ext", function(iterations) {
            var _args = [spr_quack, 0, 0, 0];
            repeat(iterations) {
                script_execute_ext(draw_sprite, _args);    
            }
        }),
        new TestCase("function call", function(iterations) {
            repeat(iterations) {
                draw_sprite(spr_quack, 0, 0, 0);    
            }
        })
    ]),
solar estuary
quasi heath
#

interesting!

#

vm pretty much what i expected

#

did not expect that from yyc

solar estuary
dire whale
#

i'm actually curious now

#

what code are you running in the script_execute_ext version?

solar estuary
#

It's at the top of the post

#

I'm not declaring a new array each time

dire whale
#

okay that was going to be my first question

#

my second question was going to be how it shakes out if you use draw_sprite_general or something with a lot more arguments

solar estuary
#

Hmm

dire whale
#

each argument to a function call is a vm stack push, which isn't much but it's something, and if you have to do like ten of them when you call the function vs just two for the args array and the function id you might find something interesting

pine zealot
# solar estuary VM:

if you have a lot of logic conditional to each draw call i would say this is maybe worth the hit

#

if only to keep things tidy

#

(i was expecting much worse tbh)

quasi heath
#

i was too

solar estuary
quasi heath
#

last time i benchmarked script execute for builts i wasnt impressed

solar estuary
#
    new Benchmark("script_execute_ext vs function call", [
        new TestCase("script_execute_ext(draw_sprite, ...)", function(iterations) {
            var _args = [spr_quack, 0, 0, 0];
            repeat(iterations) {
                script_execute_ext(draw_sprite, _args);    
            }
        }),
        new TestCase("draw_sprite(...)", function(iterations) {
            repeat(iterations) {
                draw_sprite(spr_quack, 0, 0, 0);    
            }
        }),
        new TestCase("script_execute_ext(draw_sprite_ext, ...)", function(iterations) {
            var _args = [spr_quack, 0, 0, 0, 0, 0, 0, 0, 0];
            repeat(iterations) {
                script_execute_ext(draw_sprite_ext, _args);    
            }
        }),
        new TestCase("draw_sprite_ext(...)", function(iterations) {
            repeat(iterations) {
                draw_sprite_ext(spr_quack, 0, 0, 0, 0, 0, 0, 0, 0);    
            }
        }),
        new TestCase("script_execute_ext(draw_sprite_general, ...)", function(iterations) {
            var _args = [spr_quack, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
            repeat(iterations) {
                script_execute_ext(draw_sprite_general, _args);    
            }
        }),
        new TestCase("draw_sprite_general(...)", function(iterations) {
            repeat(iterations) {
                draw_sprite_general(spr_quack, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);    
            }
        })
    ]),
dire whale
#

okay thats more or less what i was expecting

solar estuary
dire whale
#

this is basically the sprite version of "not recalculating the same world matrix every draw event" in 3D

quasi heath
#

yeah

dire whale
#

if your draw properties dont change every frame you might as well keep them around

quasi heath
#

gm has changed so much lately, with russell tinkering around the place, that this is as surprising as it is not surprising

dire whale
#

i guess this is kind of as close to retained-mode rendering as you can get in gamemaker

#

tab are you in the new runtime beta?

solar estuary
#

You know I am

#

I've been meaning to tear apart GM Benchmark again and try to get it working in new runtime

#

(aka killing off Scribble)

quasi heath
#

been avoiding gm server lol

solar estuary
#

Huh

#

I reran the test a couple times and it seems like the results has differed slightly in YYC

#

This was the "first run" in YYC

#

#JustGameMakerThings or I suppose #JustCPUThings

quasi heath
#

haha

weary dove
#

I wonder if it would be useful to get the variance from average additionally to just the average result

pine zealot
#

test app should probably show deviation hunh

weary dove
#

I ve been thinking about adding it myself and pull request it for a while, but I thought maybe it wasn't all that necessary.

solar estuary
#

I mean it would be good I'd reckon haha

dire whale
#

hmm

#

could probably add that without too much pain

#

i'll try to remember to do that some time in the next 9 years

dire whale
#

okay now this is interesting: in a test where the content actually ends up on the screen, i found that script_execute_ext is actually slower than writing everything out the long way

#

consistently by about 10-15% or so

#

also we're using the instance variables instead of locals here because variable fetches take time too - and yet it's still slower

quasi heath
#

the real test

dire whale
#

in yyc the delta's even bigger, because accessing variables is slightly cheaper and the script overhead is otherwise about the same

pine zealot
#

why self dot

dire whale
#

because i said so

quasi heath
#

self dot is fun

pine zealot
#

ok

pine zealot