ememcopy

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hi Everybody!

Last night I finally got round to inspecting Michael Bolin's
extended mem_copy() routine: such a good idea! I shoved it
into my vgraph library, and to my amazement, frame rates of
some of my demos actually dropped! If you do not believe me,
try the little test below. You will need my vgraph.e and
Michael's emecopy.e as well.

And moral of the story? Somewhat contrary to Michael's own
advice, use it for simple copying (kind=1) only if you don't
mind a marginal performance degradation, but certainly use
it with kind=2 or 3, if you want your sprites to fly! Jiri

-- snip ----------------------------------------------------
-- emctest.ex: testing Michael Bolin's extended mem copy routines
-- j.babor at gns.cri.nz

include get.e        -- wait_key()
include image.e
include ememcopy.e
include vgraph.e

constant
   tile={{0,0,0,8,8,7,7,15,15},
         {0,0,8,8,7,7,15,15,0},
         {0,8,8,7,7,15,15,0,0},
         {8,8,7,7,15,15,0,0,0},
         {8,7,7,15,15,0,0,0,8},
         {7,7,15,15,0,0,0,8,8},
         {7,15,15,0,0,0,8,8,7},
         {15,15,0,0,0,8,8,7,7},
         {15,0,0,0,8,8,7,7,15}}

object junk
sequence s
atom dt,t

-- main ------------------------------------------------------------------------

junk=graphics_mode(19)
tick_rate(100)

junk=set_up_emc()

-- time tests: 1000 iterations
v_box(tile,1,{0,0},{159,99})
t=time()
for i=1 to 1000 do
   v_copy_region(#A0000,320,{160,100},#A0000,320,{{0,0},{159,99}})
end for
dt=time()-t
position(15,1)
printf(1,"v_copy_region:%5.2f\n",dt)

t=time()
for i=1 to 1000 do
   se_mem_copy (1, #A0000, #A0000+32160, 160, 100, 320-160, 320-160)
end for
dt=time()-t
printf(1,"se_mem_copy:  %5.2f\n\n",dt)

-- generate a simple hollow sprite shape & save it
ellipse(14,1,{210,10},{249,49})
ellipse(0,1,{220,20},{239,39})
s=save_image({210,10},{249,49})

t=time()
for i=1 to 1000 do
   v_merge_image({10,10},s)
end for
dt=time()-t
printf(1,"merge_image:  %5.2f\n",dt)

t=time()
for i=1 to 1000 do
   se_mem_copy (2,#A0000+10*320+210,#A0000+10*320+60,40,40,320-40,320-40)
end for
dt=time()-t
printf(1,"se_mem_copy:  %5.2f\n",dt)


t=time()
for i=1 to 1000 do
   se_mem_copy (3,#A0000+10*320+210,#A0000+10*320+110,40,40,320-40,320-40)
end for
dt=time()-t
printf(1,"se_mem_copy:  %5.2f\n",dt)

junk=wait_key()
junk=graphics_mode(-1)

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu