对于 CPU 密集型进程,VB.NET 是否比 VB6 提供任何性能改进?
我正在研究用 VB6 编写的数学模型。该模型消耗的 CPU 时间量正成为我们的一些客户关注的问题,并且有人提出将其移植到 VB.NET 将提高其性能。
该模型正在执行大量单精度算术(大型网格上的有限差分方案),并且每五秒左右就会有一次小突发的数据库访问(还不够重要)。仅涉及偶尔使用 ^ 4 运算符的基本算术函数。
有人认为移植到 VB.NET 可能会改善问题(或不会)吗?有谁知道我可以查看哪些可靠的文章或论文来帮助做出这个决定?
I'm working on a mathematical model written in VB6. The amount of CPU time this model is consuming is becoming a concern to some of our customers and the notion has been floated that porting it to VB.NET will improve its performance.
The model is performing a lot of single-precision arithmetic (a finite-difference scheme over a large grid) with small bursts of database access every five seconds or so (not enough to be important). Only basic arithmetic functions with occasional use of the ^ 4 operator are involved.
Does anyone think porting to VB.NET is likely to improve matters (or not)? Does anyone know any reliable articles or papers I can check over to help with this decision?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我的观点是 VB.Net 到目前为止还不会提高性能。改进是由您制定优化算法的能力带来的。
My opinion is that VB.Net won't improve performance by far. The improvement is given by your ability to make an optimized algorith.
也许您可以获得的最佳性能提升是消除数据库访问(即使它看起来不重要,I/O 通常是瓶颈,而不是语言本身)。如果可能的话,预先获取数据并在最后保存,而不是每 5 秒访问一次。
另外,正如其他人指出的那样,如果可能的话,请更改算法,因为将代码移植到 .NET 可能只会给您带来很小的性能优势。
但如果您将其更改为 .NET 4.0,也许您可以使用并行扩展,并通过使用多个内核真正获得提升。 http://msdn.microsoft.com/en-us/library/dd460693.aspx ,但这也意味着,改变算法
希望它有帮助。 ;-)
Probably the best performance boost you can get is eliminating the DB access (even if it doesnt look important I/O usually is the bottleneck, not the language itself). If possible get the data upfront and save it at the end instead of accesing every 5 secs.
Also as other pointed out, change the algorithm if possible since porting the code to .NET probably will only get you small performance benefits.
But if you change it to .NET 4.0 maybe you can use the parallel extensions and really get a boost by using multiple cores. http://msdn.microsoft.com/en-us/library/dd460693.aspx , but that also means, changing the algorithm
Hope it helps. ;-)
我认为内存管理的改进提高了 VB.NET 的性能
I think that improvements in memory management improve performance in VB.NET
为了给您提供正确的答案,我们应该检查您的代码...
但是理论上VB.NET应该性能更高:
最好的尝试:将应用程序中最消耗 CPU 的部分移植到 VB.NET 并进行比较。
To provide you with a correct answer we should check your code...
But certainly VB.NET in theory should be more performant:
Best thing to try: port the most CPU consuming part of your application to VB.NET and compare.
同样的算法在 VB6 中执行得更快,因为它是用本机语言编译的。
如果程序具有大量内存分配,则在 64 位环境中运行时,它在 .NET 中的执行速度可能会更快。
The same algorithm will perform faster in VB6, because it is compiled in native language.
If the program has extensive memory allocation, it may perform faster in a .NET when running in a 64 bit environment though.