Oh, the weather outside is frightful
So I’ll stay in and play with Silverlight…
ahem…
Anyway, results from next experiment were a bit discouraging. I took the last experiment, and instead of just a single ball, made an array and 100 balls. Scaled them way down and gave them random velocities to start out with, removed the gravity. Here’s the result:
http://www.bit-101.com/silverlight/msm02/TestPage.html
Now, whereas the last one ran smoother on my Mac than on the PC where it was developed, this one runs fairly decently on the PC, but reeeeeeally slow on the Mac. What’s more, it pretty much maxes out both CPUs on my Mac Book Pro, while the PC’s single CPU averaged around 50%. Note, this is a rather low end, older PC, an AMD Turion 1.8 GHz CPU, with less than 1 GB of RAM. By all accounts, the Mac Book Pro should blow it out of the water. Could it be that Silverlight works better on Windows???
I’d be interested to hear comparative results from other users. The particles should shoot out pretty fast and most should hit the edges in just about one second. On my Mac, it takes at least 3-4 seconds til they hit, and it’s very jumpy. Odd.
[Update]
I noticed one process syslogd running on the Mac whenever I ran the file. It was taking a bunch of CPU time. I realized that I had left a System.console.Write() command in the file, so it was apparently trying to log something a whole lot. I removed that and the CPU hit on the Mac is way less, but still about 50% on both CPUs and waaaaay slower than the PC.
It could still be that I’m doing something wrong. If any Silverlight gurus want to check out the code, just ask.
The speed on my 2 GHz Intel Core Duo is fine though there is an pretty visible “stuttering” in the animation every ~1s – 2s or so. Looks like the missing onEnterFrame handler makes it difficult to get a constant framerate.
Oh – I had kept this running in a Firefox tab in the background and when I just looked at it again the motion of the balls has become super slow, to something like 10 pixels/second. And BTW – I forgot to add that I’m on Windows.
Thanks Mario. The particles will slow down each time they hit a wall, so it’s fine that they were moving really slow after a few minutes. But yeah, runs fine on Windows for me too.
OK, the funny thing is that it runs great on Windows via Parallels – on the same machine where it runs like crap on on the Mac side. Definitely a Mac/Windows thing, not a hardware thing.
hey keith,
yeah really interesting experiments. It’s weird but over here (on an MBP) it seems to be smooth for half a second or so, and then it jumps a bit.
I’ve seen similar things happening recently – the UK Expression guy John Allwright converted some of my particle code into Silverlight, I just posted them on my blog. It’s not really anywhere as cool as the Flash versions, but very interesting nonetheless.
Oh and definitely seems to run better on Windows. (Although wasn’t that the case with Flash also, until very recently?)
hope you’re well and holed up for the winter, trust me, you don’t want to be in Brighton right now
cheers
Seb
Seb, yes indeed, Flash has seen better performance on PCs until recently. This made me think of some of the things Bill Gates said. One was where he was talking about Silverlight, starting now, was able to take advantage of a lot of the things that Flash had work out over the years. That may be true in terms of workflows and what is needed in the outside world, but the other side of that coin is that Adobe/Macromedia has had years to work out technical things like cross platform compatibility – getting it not just to work, but work well on (at least) both platforms.
The other thing he mentioned was that perhaps Silverlight would concentrate on just the Windows platform, as they could do much better integration there. I think it’s pretty interesting that he left that open as a possibility. I thought cross platform would be more important. Curious to see where this goes.
It runs well on my Vista, but the animation jitters at about half a second when the balls are exploding, other than that, the rest is smooth. I wonder what it looks like when you have 1,000 balls, and what a Flash counterpart would look like.
Actually I tried it with 1000. Forget about it. I was getting maybe 6 fps on Windows. Then again, I might be able to do a lot of optimization.
Hey nice blog!
Some time ago I was wandering in starting Silverlight.. but because your post I saw that is still early.. Better to use XNA to train C# than Silverlight =D .. I had hope that it’s player could be faster than AVM2 but not yet…
I have a blog too about general programming (AS,C,C++,C#,..) game,math and physics… It’s in early stage but walking.. Your blog has a spot in my links tab!
Keep the great work!!
I like how I had was prompted to install SilverLight. So I download, run, install, restart browser, goto link again, need to install SilverLight. Very nice MS.
hmm… Taking a look at the code now… ( I ran it on my MacBook Pro and didn’t notice the CPU hike but i’m also running a different Runtime than you would typically so that could be why – which may indicate it’s fixed in future iterations
heh *may* )
–
Scott Barnes
RIA Evangelist
Microsoft.
thats an obvious lie. There is no way Scott owns a MacBook Pro…
I don’t see a fps counter… have you implemented one?
If not, its not hard to use the plugin’s (shown in the browser status bar). I usually put it in the onLoad event of createObjectEx():
events: {onLoad:function(){document.getElementById(“SilverlightControl”).settings.EnableFrameRateCounter = true;}
hey keith i think there are some known issues with the alpha on mac right now…we’re working on it and i believe this is one of them. it’s still an early alpha build for now, so some of these sporadic issues will be there in these builds.
Mark: The MacBook Pro is probably the fastest Vista ready laptop on the market
(I run bootcamp).
As regards to the problem, what Tim said +1. It’s a bug, “..the beatings will continue until moral improves..”
–
Scott Barnes
RIA Evangelist
Microsoft.
Same thing here..
I get to a page with a “get Microsoft Silverlight” logo. I did the download and download and still get the same page (windows xp).
At least it not the “click here to activate this control” that many mac developpers are leaving here and there (if you dont see it, you cant fix it!)
ah! ah!
Hi,
Known bug which is getting fixed . when it comes down to it, the bug is: SetValue of a double takes 10x slower on the Mac than Windows. The issue is that some minute function was written in assembly, and that was not translated to intel-mac. Multiple ways to fix, we will get the fix out shortly.
Sorry about letting this one through. Let me know if you see any other disparities between Mac & Windows performance.
-Seema, Silverlight Performance PM
seemar@MS
Thanks Seema. That makes sense. Good to know it’s being fixed.