Click here to Skip to main content
15,886,547 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a program that caches thumbnail images generated from a multi-page tiff. The performance on my development machine is terrible compared to other computers and a vm run within my dev machine. My development machine is what I would consider a pretty clean Win 7 x64 setup with a processor score of 7.3 per Windows Experience. I tested loading times on 3 different setups using a 250 page tiff file 5 times on each setup. The same exe and test tiff file were used. The exe was built using the Any CPU platform with Visual Studio 2010 Professional. I've tried compiling with various .net versions and platform changes with the same results. The results below were obtained using release builds built on .net 4.

Win 7 x64 (Intel Q9300 @ 3 GHz dev comp): 68515,68203,67985,68421,68328 = 68290 (ave ms)
Win XP x64 (virtual machine on dev comp): 21703,14890,17500,21015,15515 = 18125 (ave ms)
Win Vista x64 (different comp with slower CPU): 11466,11372,11450,11653,11325 = 11453 (ave ms)
Win XP x86 (Intel E8400 @ 3 GHz): 13391,13172,13062,13031,13047 = 13140.6 (ave ms)

The program was also used on my work computer (XP x86) with quick loading times, but I don't have numbers. I'm at a loss as to why the performance is so bad on my dev machine. I've tried disabling any program that could affect performance, but nothing works and Google has failed me.

I don't really have a specific question, but would appreciate any clues as to why this may be happening e.g. compiler settings, .net runtime settings, etc. I have no idea why a slower computer would be ~6x faster and a virtual machine within the problem computer is ~4x faster than running the program directly within the installed OS (Win 7).

Thanks in advance for any suggestions.
Posted
Updated 16-Mar-12 3:03am
v3

Hi,

it's really depending on your graphics card or rather the drivers, it sometimes help to try other/newer version.
WPF is using hardware accleration and if set, antialiasing.
Maybe you could increase performance by installing vmware tools, but some functions are still unavailable.
Here's a way how to customize the rendering settings of a wpf application to increase/adapt it to hardware configuration.

http://msdn.microsoft.com/en-us/library/aa970912.aspx[^]


With Best Regards
 
Share this answer
 
v3
Björn, thanks for your response. I'm skeptical it is a graphics card issue, but I am by no means an expert. I'm using the current AMD drivers and have a Raedon HD 6670 card. My app was created using the generic "Windows Forms Application" option in Visual Studio 2010. I'm not using any WPF features that I'm aware of. Below is my cache & load code. Only one image is loaded into a PictureBox and visible. The rest of the images are cached into an IList so I can access them quickly at a later time. I'm not a programmer by trade so if my implementation is not done well I'll take tips on that too :)

I'd like the program to work properly using only the .net runtime and do not want to require additional third party tools like vmware. Everything appears to work well on machines other than my dev machine. Any other suggestions are welcome. Thanks!

C#
private void loadImage(Image i)
{
    p.Image = i.GetThumbnailImage((int)numericUpDown1.Value, (int)(numericUpDown2.Value), null, IntPtr.Zero);
}

delegate int cacheImagesD(string fileName);
private int cacheImages(string fileName)
{
    FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
    image = Image.FromStream(fs);

    printPagesTotal = image.GetFrameCount(FrameDimension.Page);

    Invoke(spd, new object[] { printPagesTotal });

    for (int x = 0; x < printPagesTotal; x++)
    {
        image.SelectActiveFrame(FrameDimension.Page, x);
        MemoryStream byteStream = new MemoryStream();
        image.Save(byteStream, ImageFormat.Bmp);
        images.Add(Image.FromStream(byteStream));

        Invoke(upd);
    }
    fs.Close();
    return printPagesTotal;
}
 
Share this answer
 
okay, a radeon hd 6670 is more than enough for smooth rendering.
Except without using WPF I can't believe that it can be slower than on other (older) systems.
I don't mean that you require vmware, it's only a fact that applications doesn't run in vm as well as without using vm machines.

So my conclusion is similar with yours yet, if it's running smoothly with your other pc's (using the same setup,compiled as release version, not debug, same tiff file).

So I would try it on one more Win7 x64 and if it's running well, there must be something wrong with dev machine, but that's quite hard to say, can't have a look at your system configuration and your hdd.

Your code seems to work, I had a look over it and the only thing IMHO would change is using the using Statement with FileStream and Memorystream because of right Disposing() of the streams.

Please give a feedback to us, it's an interesting question for me :D.

Regards
 
Share this answer
 
v2
Tried a couple different setups. Fresh install of Win 7 x64 SP1 on dev machine with no programs installed other than .net framework 4. Same results within 1% of the dev machine tests above. Fresh install Win 7 x64 on comparable computer with only .net framework 4 installed. Same slow results as dev machine. Numbers from my work computer were added above. Win XP x86 (Intel E8400 @ 3 GHz): 13391,13172,13062,13031,13047 = 13140.6 (ave ms)

Probably a big waste of my time to run tests on clean installs XP and Vista on my dev machine, but that would provide the most accurate comparison. Will give it a shot this weekend if I have time. Any additional suggestions are welcome.

Conclusion: I'm still stumped...
 
Share this answer
 
v2
You said you're loading a 250-page TIFF file five times - looks to me like it's a matter of hard drive access. This could be a result of a faulty controller on the motherboard, a dodgy cable, an inherently slow hard drive, or one that is heavily fragmented. It could even be cache settings in Windows (you listed four different versions).
 
Share this answer
 
v2
Comments
El_Codero 16-Mar-12 13:05pm    
Hi, good points but if app runs faster in vm on same machine a faulty controller,corrupt cable or hard drive speed is out of question (in my opinion). Remains defragmentation,cache settings, buggy driver on host dev machine, ... a lot of watching the sandglass ;)
The tests on my dev machine were done when the test tiff was placed on a ramdisk, but other tests run on that machine were done from a normal hard drive. The results were essentially identical. Several tests on a different computer with Win 7 x64 were done which yielded the same slow results. Each test was done independently. By independently I opened the program, ran a test, documented the results, closed the program and reopened it to start the next test. I'm confident this is not a hardware issue.

As far as a cache setting in Windows that is something I'd be interested in looking at. That gets back to my initial issue of why does Windows 7 perform significantly worse than other versions of Windows (XP & Vista). In essence is there some setting in Win 7 that is causing this?

Thanks for your feedback.
 
Share this answer
 
v2
It's possible to tweak Win7 through creating ramdisk, adapting pagefile.sys, cleaning registry (ccleaner), ... However it's useless if you reformatted,reinstalled your win, but that's not the real problem.

Here's a link to optimize win7:
http://programming4.us/desktop/2082.aspx[^]


I rereaded your solution 4 and you wrote:
Fresh install Win 7 x64 on comparable computer with only .net framework 4 installed. Same slow results as dev machine.

So for my understanding it's only slower in case Win 7 is installed?

If you get same (slow) result only with Windows 7 (on compareable hardware) I consider because Win7 uses some techniques which costs more performance than running under XP (in case there is no antivirus/other service is running). But it's not easy to say without testing it by self.
 
Share this answer
 
v5
Based on the posts/articles below GDI+ was changed in Win 7 and is likely the cause of my problems. Unless I'm totally off base I'm going to have to use a technology other than starting with the Windows Forms Application in VS 2010 if I want consistent performance across all windows versions. Thanks for the comments.

http://www.windows7taskforce.com/view/3607[^]

http://www.pcpro.co.uk/blogs/2009/05/07/windows-7-gdi-performance-the-big-trade-off/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900