Blog'A'Little

Just another C# guy

Overcoming Silverlight speed issues in Silverlight 1.1 Alpha (Managed code)

I've been close to ranting lately about my issues with speed for Silverlight 1.1.. Shame on me, a little bit.. :)   

I have now refactored my 3D a bit and I'm now experiencing increased speed. The main problem is that if you want to runtime generate the visuals for every frame there is too much marshalling going on between the managed runtime and the core presentation engine of Silverlight. After a couple of days of real frustration I got struck by lightning (Silver ofcourse). I ran in to my livingroom from playing with one of my kids and grabbed my laptop and ran outside again to "play"...   The answer is : Generate the XAML and marshal only once! This can be achieved in several ways, I chose to create myself a user control that I dynamically create and add to my Canvas every frame (only one), within this user control I generate the XAML needed and pass it along to the InitializeFromXaml() method found in the base class Control.

This resulted in the engine using around 10 milliseconds per frame on my test object. It used between 30 and 40 milliseconds before. (My machine : Dell Latitude D820 Laptop, running Intel Core Duo 2.33 Mhz)

It is kind of obvious that this is the result. Since the managed environment is decoupled in the manner it is, it will make sense to marshal as little as possible.

I've implemented this into the Balder engine, if you want to have a look at how it is done, download the source at Codeplex (http://www.codeplex.com/Balder). PolyControl.cs and Face.cs is in this writing moment the magicians. This will change soon when I clean up it's act.

Check out the latest version, optimized :
http://www.dolittle.com/Silverlight/3D_Optimized/TestPage.html

(There is not a lot of added features, just optimizations and behind-the-scenes stuff...)

 

 

kick it on DotNetKicks.com kick it on GameDevKicks.com

Comments

Chris Cavanagh said:

Einar - Excellent post!  It's amazing that parsing XAML strings can actually be faster than using the API.  Your demos are great!

kick it on DotNetKicks.com kick it on GameDevKicks.com
# juni 29, 2007 9:22

Einar Ingebrigtsen said:

Thanks a lot.

It is kind of odd. One would think that parsing the XML and adding it to the rendering pipeline every frame would cost more than marshalling the objects across. The marshalling process must be really costy.

kick it on DotNetKicks.com kick it on GameDevKicks.com
# juli 10, 2007 8:34

fliquefielf said:

<b>Bluetooth для приемников Haicom CF</b>

<a href=info.je1.ru/.../a>

kick it on DotNetKicks.com kick it on GameDevKicks.com
# mars 4, 2010 2:49

albuterol sulfate said:

Hi there, I establish up your blog via Google while searching in retribution as a remedy for cardinal better representing a callousness combat in mel‚e and your ice looks very inviting seeing that me

kick it on DotNetKicks.com kick it on GameDevKicks.com
# september 5, 2010 6:18

link exchange said:

hello there  thanks for your grat post, as usual ((o:

kick it on DotNetKicks.com kick it on GameDevKicks.com
# november 17, 2010 8:40

football said:

Hello Everyone! I like watching <a href=www.finsfootball.com/bbc-football>bbc football</a>. I usually watch <a href=http://www.finsfootball.com>football online</a> as I do not have PVR. How about you?

kick it on DotNetKicks.com kick it on GameDevKicks.com
# februar 12, 2011 3:27

JoinGames said:

Что подарить девушке на 8-е марта?

kick it on DotNetKicks.com kick it on GameDevKicks.com
# februar 28, 2011 4:06

cna training said:

Hi Find A good Site About Cna Traning guide <a href=http://www.onlinecnatrainingprogram.com>online cna traning</a>

kick it on DotNetKicks.com kick it on GameDevKicks.com
# mars 2, 2011 9:20

triettyemaibe said:

Nice site <a href=http://kaeuxdvl.com>. :)</a>

kick it on DotNetKicks.com kick it on GameDevKicks.com
# mars 10, 2011 11:14

buyprohormones said:

I see you spent a lot of time writing your site

<a href=http://topmusclesupplements.org>prohormones for sale</a>

kick it on DotNetKicks.com kick it on GameDevKicks.com
# april 23, 2011 7:57

Dianabal said:

I like www.dolittle.com , bookmarked for future reference

<a href=www.buzzfeed.com/.../legal-steroids-prohormones-bodybuilding-supple-39dn>legal steroids</a>

kick it on DotNetKicks.com kick it on GameDevKicks.com
# mai 16, 2011 11:03

qfsmangqym said:

# november 30, 2011 3:31

xjrdcwpouh said:

# november 30, 2011 3:37

becvwxttnl said:

# november 30, 2011 3:59

oiffklbndi said:

# november 30, 2011 4:04

globhiscmp said:

ukevtepmjuumf, http://www.inxuouredc.com wjtzseekic

kick it on DotNetKicks.com kick it on GameDevKicks.com
# november 30, 2011 9:16

tuklqvfjsy said:

fnxpzepmjuumf, http://www.totkpdiflo.com eojickzndt

kick it on DotNetKicks.com kick it on GameDevKicks.com
# november 30, 2011 9:21

mwoeiponkl said:

# desember 6, 2011 6:58

drjaohtwcz said:

# desember 6, 2011 7:25

chhdijviwi said:

# desember 6, 2011 9:56

qqlqmqodaa said:

# desember 6, 2011 10:23

zixbvduntp said:

# desember 7, 2011 11:32

zcqhgpuzas said:

# desember 7, 2011 12:04

afosrqexnx said:

# desember 7, 2011 2:44

tgfgpvbczd said:

# desember 7, 2011 3:17

xiiweniaph said:

# desember 7, 2011 5:34

igrfjdifig said:

etjiyepmjuumf, http://www.vibddrypsx.com xljwvnjipb

kick it on DotNetKicks.com kick it on GameDevKicks.com
# desember 7, 2011 6:28

gaohglohcv said:

ubwcnepmjuumf, http://www.qbctqjdaft.com aggdkmiuzl

kick it on DotNetKicks.com kick it on GameDevKicks.com
# desember 7, 2011 6:58

ydramtmnhf said:

ifleaepmjuumf, http://www.edqtwmkyuy.com jjemmiczty

kick it on DotNetKicks.com kick it on GameDevKicks.com
# desember 7, 2011 9:52

mlzhohnliw said:

sbvqpepmjuumf, http://www.qpwbyowucm.com gautieywja

kick it on DotNetKicks.com kick it on GameDevKicks.com
# desember 7, 2011 10:20

vpcchbmudj said:

# desember 14, 2011 10:00

uxtsxmlkcc said:

# desember 14, 2011 10:09

kadogkxquy said:

# desember 14, 2011 10:49

wqtfctmdun said:

# desember 14, 2011 10:59

ozwjckspjg said:

# desember 14, 2011 11:39

nbqivtscvp said:

# desember 14, 2011 11:48

gajablakkp said:

vqehwepmjuumf, http://www.vsbeoioepj.com xbapcmtetb

kick it on DotNetKicks.com kick it on GameDevKicks.com
# desember 15, 2011 1:01

qtothghdbz said:

maveoepmjuumf, http://www.thersgljcx.com tidcvnbymz

kick it on DotNetKicks.com kick it on GameDevKicks.com
# desember 15, 2011 1:11

fllgrnakgm said:

lgiazepmjuumf, http://www.gwwywhlgbz.com vbruxoiggh

kick it on DotNetKicks.com kick it on GameDevKicks.com
# desember 15, 2011 1:51

rwiednfvec said:

xfzouepmjuumf, http://www.xpfwjgsytg.com vvdkzzjcrw

kick it on DotNetKicks.com kick it on GameDevKicks.com
# desember 15, 2011 2:00
Leave a Comment

(required) 

(required) 

(optional)

(required) 

Design downloaded from Free Templates - your source for free web templates