.net程序的性能在计算机之间差异很大 [英] .net program performance varies greatly between computers

查看:81
本文介绍了.net程序的性能在计算机之间差异很大的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个程序可以缓存从多页tiff生成的缩略图.与其他计算机和在我的开发机中运行的vm相比,我的开发机的性能糟透了.我的开发机器是我认为非常干净的Win 7 x64设置,每Windows体验的处理器得分为7.3.我使用250页tiff文件在3种不同的设置上对每种设置测试了5次加载时间.使用相同的exe和测试tiff文件.该exe是使用带有Visual Studio 2010 Professional的Any CPU平台构建的.我尝试使用各种.net版本和平台更改进行编译,但结果相同.使用基于.net 4的发行版获得以下结果.

Win 7 x64(Intel Q9300 @ 3 GHz dev comp):68515,68203,67985,68421,68328 = 68290(ave ms)
Win XP x64(Dev Comp上的虚拟机):21703,14890,17500,21015,15515 = 18125(ave ms)
Win Vista x64(与较慢的CPU相比具有不同的Comp):11466,11372,11450,11653,11325 = 11453(ave ms)
Win XP x86(Intel E8400 @ 3 GHz):13391,13172,13062,13031,13047 = 13140.6(ave ms)

该程序还可以在我的工作计算机(XP x86)上使用,加载速度很快,但是我没有数字.我不知道为什么我的开发机器上的性能如此差.我曾尝试禁用任何可能影响性能的程序,但没有任何效果,并且Google让我失败了.

我确实没有一个具体的问题,但是希望您能了解到为什么会发生这种情况的任何线索.编译器设置,.net运行时设置等.我不知道为什么速度较慢的计算机要快6倍,而问题计算机中的虚拟机却比直接在已安装的OS(Win 7)中运行程序快4倍. br/>
预先感谢您的任何建议.

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.

推荐答案



它实际上取决于您的图形卡或驱动程序,有时可以尝试使用其他/较新的版本.
WPF正在使用硬件加速,如果已设置,则使用抗锯齿.
也许可以通过安装vmware工具来提高性能,但是某些功能仍然不可用.
这是一种如何自定义wpf应用程序的呈现设置以使其增加/适应硬件配置的方法.

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


致以最诚挚的问候
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


Björn,感谢您的回复.我对此表示怀疑,但我绝不是专家.我正在使用当前的AMD驱动程序,并具有Raedon HD 6670卡.我的应用程序是使用Visual Studio 2010中的常规"Windows窗体应用程序"选项创建的.我没有使用我知道的任何WPF功能.以下是我的缓存&加载代码.只有一个图像被加载到PictureBox中并可见.其余图像被缓存到一个IList中,以便以后可以快速访问它们.我不是行业程序员,所以如果我的实现不顺利,我也会在此方面提供一些技巧:)

我希望该程序仅使用.net运行时才能正常运行,并且不希望使用vmware等其他第三方工具.在我的开发机器以外的机器上,一切似乎都可以正常运行.任何其他建议,欢迎.谢谢!

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!

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;
}


好的,radeon hd 6670足以进行平滑渲染.
除了不使用WPF,我无法相信它会比其他(旧)系统慢.
我并不是说您需要 vmware,这只是事实,即应用程序不能在vm中运行,也可以在不使用vm机器的情况下运行.

所以我的结论与您的结论相似,如果它可以与其他PC平稳运行(使用相同的设置,编译为发行版,而不是调试,使用相同的tiff文件).

因此,我将在另一台Win7 x64上进行尝试,如果运行良好,则开发机肯定存在问题,但这很难说,无法了解您的系统配置,您的硬盘.

您的代码似乎正常工作,我看了一下,恕我直言,唯一会更改的地方是使用了using Statement和FileStream Memorystream ,这是因为流的Dispose()正确.

请给我们反馈,这对我来说是一个有趣的问题:D.

问候
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


这篇关于.net程序的性能在计算机之间差异很大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆