与Windows 7相比,Windows 10性能较差(页面错误处理不可扩展,没有
我们设置了两个相同的HP Z840工作站,其规格如下
> 2 x Xeon E5-2690 v4 @ 2.60GHz(Turbo Boost ON,HT OFF,共28个逻辑CPU) 并在每个上安装了Windows 7 SP1(x64)和Windows 10 Creators Update(x64). 然后我们运行了一个小内存基准测试(下面的代码,使用VS2015 Update 3,64位架构构建),它可以同时从多个线程执行内存分配 – 无填充. #include <Windows.h> #include <vector> #include <ppl.h> unsigned __int64 ZQueryPerformanceCounter() { unsigned __int64 c; ::QueryPerformanceCounter((LARGE_INTEGER *)&c); return c; } unsigned __int64 ZQueryPerformanceFrequency() { unsigned __int64 c; ::QueryPerformanceFrequency((LARGE_INTEGER *)&c); return c; } class CZPerfCounter { public: CZPerfCounter() : m_st(ZQueryPerformanceCounter()) {}; void reset() { m_st = ZQueryPerformanceCounter(); }; unsigned __int64 elapsedCount() { return ZQueryPerformanceCounter() - m_st; }; unsigned long elapsedMS() { return (unsigned long)(elapsedCount() * 1000 / m_freq); }; unsigned long elapsedMicroSec() { return (unsigned long)(elapsedCount() * 1000 * 1000 / m_freq); }; static unsigned __int64 frequency() { return m_freq; }; private: unsigned __int64 m_st; static unsigned __int64 m_freq; }; unsigned __int64 CZPerfCounter::m_freq = ZQueryPerformanceFrequency(); int main(int argc,char ** argv) { SYSTEM_INFO sysinfo; GetSystemInfo(&sysinfo); int ncpu = sysinfo.dwNumberOfProcessors; if (argc == 2) { ncpu = atoi(argv[1]); } { printf("No of threads %dn",ncpu); try { concurrency::Scheduler::ResetDefaultSchedulerPolicy(); int min_threads = 1; int max_threads = ncpu; concurrency::SchedulerPolicy policy (2 // two entries of policy settings,concurrency::MinConcurrency,min_threads,concurrency::MaxConcurrency,max_threads ); concurrency::Scheduler::SetDefaultSchedulerPolicy(policy); } catch (concurrency::default_scheduler_exists &) { printf("Cannot set concurrency runtime scheduler policy (Default scheduler already exists).n"); } static int cnt = 100; static int num_fills = 1; CZPerfCounter pcTotal; // malloc/free printf("malloc/freen"); { CZPerfCounter pc; for (int i = 1 * 1024 * 1024; i <= 8 * 1024 * 1024; i *= 2) { concurrency::parallel_for(0,50,[i](size_t x) { std::vector<void *> ptrs; ptrs.reserve(cnt); for (int n = 0; n < cnt; n++) { auto p = malloc(i); ptrs.emplace_back(p); } for (int x = 0; x < num_fills; x++) { for (auto p : ptrs) { memset(p,num_fills,i); } } for (auto p : ptrs) { free(p); } }); printf("size %4d MB,elapsed %8.2f s,n",i / (1024 * 1024),pc.elapsedMS() / 1000.0); pc.reset(); } } printf("n"); printf("Total %6.2f sn",pcTotal.elapsedMS() / 1000.0); } return 0; } 令人惊讶的是,与Windows 7相比,Windows 10 CU的结果非常糟糕.我将下面的结果绘制为1MB块大小和8MB块大小,将线程数从2,4,…更改为28.当我们增加线程数时,性能略差,Windows 10的可扩展性更差. 我们已尝试确保应用所有Windows更新,更新驱动程序,调整BIOS设置,但未成功.我们还在其他几个硬件平台上运行了相同的基准测试,所有这些都为Windows 10提供了类似的曲线.所以它似乎是Windows 10的一个问题. 有没有人有类似的经历,或者对此有所了解(也许我们错过了什么?).这种行为使我们的多线程应用程序获得了显着的性能损失. ***已编辑 使用https://github.com/google/UIforETW(感谢Bruce Dawson)分析基准测试,我们发现大部分时间都花在内核KiPageFault上.进一步向下挖掘调用树,所有这些都导致ExpWaitForSpinLockExclusiveAndAcquire.似乎锁争用导致此问题. ***已编辑 在同一硬件上收集Server 2012 R2数据. Server 2012 R2也比Win7差,但仍然比Win10 CU好很多. ***已编辑 它也发生在Server 2016中.我添加了标签windows-server-2016. ***已编辑 使用来自@ Ext3h的信息,我修改了基准测试以使用VirtualAlloc和VirtualLock.与不使用VirtualLock时相比,我可以确认显着改进.当使用VirtualAlloc和VirtualLock时,整体Win10仍然比Win7慢30%到40%.
Microsoft似乎已经解决了Windows 10 Fall Creators Update和Windows 10 Pro for Workstation的这个问题.
这是更新的图表. Win 10 FCU和WKS的开销低于Win 7.作为交换,VirtualLock似乎有更高的开销. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- Windows上的Python子进程输出?
- 多实例 – Windows Universal App的多个实例(Windows 10)
- 在R中创建一组同步的Windows 7 PC并行处理?
- windows-server-2008 – Windows Server 2008 R2,重新安装而
- 如何在Windows上重启Apache? “Apache -k restart”给出错
- .net – Windows Server 2008上的最大tcp / ip连接
- windows-7 – 在Windows 7中将程序作为域管理员帐户运行并以
- 在Windows上强制删除文件
- 64位win7/win8/win10系统注册32位控件(.OCX)
- windows – 恢复工具包的建议
- Windows – 没有共享存储的Hyper-V Live迁移?
- .net – Windows Phone 7 XNA GUI框架
- Windows Azure Powershell部署错误 – “远程服务
- windows-phone-7 – 在tombstone之后恢复LongLis
- windows-8 – 使用WinRT API编写的应用程序是否可
- 如何在Windows Vista上编译为Linux / Unix编写的
- Windows搜索 – 全文搜索c#
- Windows 10上的Realm数据浏览器
- windows – 用于目录大小计算的免费工具/脚本
- 在Windows Phone 7上使用WCF的System.Unsupporte