tag:blogger.com,1999:blog-563071785757928434.post3600911728615848094..comments2024-02-21T08:31:04.853+01:00Comments on Kodierer [Coder]: Silverlight 3 WriteableBitmap PerformanceRene Schultehttp://www.blogger.com/profile/12777157871967896549noreply@blogger.comBlogger16125tag:blogger.com,1999:blog-563071785757928434.post-55830482373513625742012-06-04T10:55:21.555+02:002012-06-04T10:55:21.555+02:00Nice code, thanks for sharing.Nice code, thanks for sharing.Mesin Fotocopyhttp://www.no1-office.com/about-us.htmlnoreply@blogger.comtag:blogger.com,1999:blog-563071785757928434.post-35249225099198812832009-07-28T14:47:45.679+02:002009-07-28T14:47:45.679+02:00Hello Julien
I thought I've read in the Silve...Hello Julien<br /><br />I thought I've read in the Silverlight forums that SL3 Quakelight uses the WriteableBitmap. ???<br /><br />It would be good if you could make a 32 Bit ARGB version of your PNG wrapper and send the source code to me. Otherwise the comparision with the other implementations would be falsified.<br />You can find my Email address at my website: http://rene-schulte.info<br /><br />BTW, I tried the Quakelight tech demo at SilverArcade.com. It's really cool and fast. I'm looking forward to the playable version. Keep up the good work!Rene Schultehttps://www.blogger.com/profile/12777157871967896549noreply@blogger.comtag:blogger.com,1999:blog-563071785757928434.post-77643583201629173062009-07-28T14:20:35.871+02:002009-07-28T14:20:35.871+02:00Hello Rene,
Have you considered testing the PNG w...Hello Rene,<br /><br />Have you considered testing the PNG wrapper technique used in Quake in Silverlight?<br /><br />I recently published the whole C# source code for Quakelight at http://www.innoveware.com.<br />The PNG wrapper is available in the source tree.<br />Just ask if you want an example on how to use it.<br /><br />To my knowledge, this is the fastest implementation possible. If you want an implementation without the need for a 256 colors palette, just ask.Julien Frelathttp://www.innoveware.comnoreply@blogger.comtag:blogger.com,1999:blog-563071785757928434.post-19174002595039824392009-07-27T22:20:49.347+02:002009-07-27T22:20:49.347+02:00I have yet to use Silverlight 3, I used Silverligh...I have yet to use Silverlight 3, I used Silverlight 2 a few months ago, and really liked how it worked. I would like to learn more about how this works in the future.<br /><br />http://www.onlinewebmarket.net/google/Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-563071785757928434.post-85984331063788492612009-07-26T13:00:46.796+02:002009-07-26T13:00:46.796+02:00Paul, I haven't changed the test code itself, ...Paul, I haven't changed the test code itself, only the "Maximum Frames" TextBox was added. I guess the tests were interrupted during your first try.Rene Schultehttps://www.blogger.com/profile/12777157871967896549noreply@blogger.comtag:blogger.com,1999:blog-563071785757928434.post-21347283251323550382009-07-26T10:30:15.859+02:002009-07-26T10:30:15.859+02:00Ah, I get very different results with this setup, ...Ah, I get very different results with this setup, even with the same number of frames. Nokola is 0.51 relative to WritableBitmap. Fortunately a clear conclusion now, WritableBitmap is the way to go.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-563071785757928434.post-3735259357168586822009-07-25T15:52:29.720+02:002009-07-25T15:52:29.720+02:00Rene: I've abandoned the PNG thingy for Balder...Rene: I've abandoned the PNG thingy for Balder anyways and gone with WriteableBitmap - I am doing some optimizations using it and doing some triple-buffering magic utilizing multiple threads to get real performant. My tests now show a steady FPS of 60, compared to 30-40 before.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-563071785757928434.post-7111717363522495592009-07-25T13:38:38.935+02:002009-07-25T13:38:38.935+02:00Thanks Paul.
Now that’s interesting, Nikola’s Png...Thanks Paul.<br /><br />Now that’s interesting, Nikola’s PngEncoder performs better on your computer than the WriteableBitmap. I haven’t looked deeply into Nikola’s PNG Encoder implementation or the WriteableBitmap. Maybe the tests are running to fast and therefore the results are wrong. <br />I updated the Speedtest application. It’s now possible to set the duration of the tests ("Maximum Frames"). Please try a high value for that (> 1000) and run the tests again. Make sure no other application interrupts the tests too much and that you don’t change the website.Rene Schultehttps://www.blogger.com/profile/12777157871967896549noreply@blogger.comtag:blogger.com,1999:blog-563071785757928434.post-59506227298234792452009-07-25T13:23:22.122+02:002009-07-25T13:23:22.122+02:00Thanks Einar.
You did a great job by providing a ...Thanks Einar.<br /><br />You did a great job by providing a PNG Stream implementation, which made it possible to generate dynamic bitmaps before Silverlight 3! As you know, it’s nearly impossible to compete with a good Framework internal implementation like the WriteableBitmap.<br />I used the latest RawPngBufferStream from the Codeplex repository, but maybe I made a mistake in my Speedtest application and the results are wrong. It would be nice, if you could do a quick look over the Speedtest code just to make sure the results are right.Rene Schultehttps://www.blogger.com/profile/12777157871967896549noreply@blogger.comtag:blogger.com,1999:blog-563071785757928434.post-56913488676490268002009-07-25T11:16:16.398+02:002009-07-25T11:16:16.398+02:00great post!
On my machine Nokola PngEncoder is c...great post! <br /><br />On my machine Nokola PngEncoder is consistently faster though. 1,12 relative to WritableBitmap.<br />I have a DELL Latitude D830.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-563071785757928434.post-49388688197950148572009-07-25T07:52:22.721+02:002009-07-25T07:52:22.721+02:00Great to see some hard facts on this.
Kinda bumm...Great to see some hard facts on this. <br /><br />Kinda bummed out that my RawPngBufferStream didn't quite measure up, though. :) Seeing I spent quite a bit of work trying to optimize it.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-563071785757928434.post-55588909355530305382009-07-24T17:20:18.661+02:002009-07-24T17:20:18.661+02:00Excellent article!Excellent article!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-563071785757928434.post-48934631517140472272009-07-24T15:49:05.235+02:002009-07-24T15:49:05.235+02:00Thanks John.
You’re right, most of the time is sp...Thanks John.<br /><br />You’re right, most of the time is spent in the CalculateColor() function, but all 4 dynamic bitmap implementation tests use this function and the same iterations to produce the image. Therefore it isn't part of the performance measurement. <br />If the same value is just copied to the buffer over and over, the calculation is too fast and would not represent a real use case. Removing the whole CalculateColor() function is even worse. The compiler or the WriteableBitmap implementation could do some optimizations and distort the results. In fact, if you remove the CalculateColor() function, the values of r, g, b, a never change and writeableBmp.Pixels[index++] = 0xFF000000 is always executed.<br /><br />I added some more explanations about the CalculateColor() function in the "How it works" section.Rene Schultehttps://www.blogger.com/profile/12777157871967896549noreply@blogger.comtag:blogger.com,1999:blog-563071785757928434.post-92117054986264443852009-07-24T13:45:33.511+02:002009-07-24T13:45:33.511+02:00Thank you for another excellent article.
I see a l...Thank you for another excellent article.<br />I see a little problem with your results tho and testing .<br />Most of the time program spends inside calculateColor function. Thus you dont see such a big difference between methods. If you remove this function, you will get very dramatic difference.<br />On my machine i got 120 fps for writable bitmap and only 55fps for the second closest (nokola).Johnhttps://www.blogger.com/profile/15574184701499492398noreply@blogger.comtag:blogger.com,1999:blog-563071785757928434.post-22777293097931490082009-07-24T12:15:13.015+02:002009-07-24T12:15:13.015+02:00Thanks.
Although I'm using relative values f...Thanks. <br /><br />Although I'm using relative values for comparison, it might well be that you encounter slightly different results. Depending on your hardware each implementation could perform better or worse.Rene Schultehttps://www.blogger.com/profile/12777157871967896549noreply@blogger.comtag:blogger.com,1999:blog-563071785757928434.post-71303916397074217122009-07-24T09:10:19.215+02:002009-07-24T09:10:19.215+02:00Excellent post. Nice to see some facts and figures...Excellent post. Nice to see some facts and figures and a runnable demo. The figures on my machine were slightly different to yours (0.58, 0.84, 0.56, 1 in the order of your bar chart) but the WritableBitmap still came out on top.<br /><br />I'd be interested in seeing some scenarios, if any, where the alternative methods are more performant.Anonymousnoreply@blogger.com