最快的数学编程语言?
我有一个需要数百万次减法和余数的应用程序,我最初在 C#.Net 内部编写了这个算法,但处理这些信息需要五分钟,而且我需要比这更快的速度。
我考虑过 perl,现在它似乎是最好的选择。 Vb.net 在测试中速度较慢。 C++ 可能也更好。任何建议将不胜感激。
I have an application that requires millions of subtractions and remainders, i originally programmed this algorithm inside of C#.Net but it takes five minutes to process this information and i need it faster than that.
I have considered perl and that seems to be the best alternative now. Vb.net was slower in testing. C++ may be better also. Any advice would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
您需要一种编译语言,例如 Fortran、C 或 C++。其他语言旨在为您提供灵活性、面向对象或其他优势,并假设绝对最快的性能不是您的最高优先级。
了解如何从单个线程中获得最大性能,并在完成此操作后研究如何在多个内核之间共享工作,例如使用 MPI。为了在单个线程中获得最大性能,我做的一件事就是在机器指令级别单步执行它,以确保它不会在可以删除的东西上徘徊。
You need a compiled language like Fortran, C, or C++. Other languages are designed to give you flexibility, object-orientation, or other advantages, and assume absolutely fastest performance is not your highest priority.
Know how to get maximum performance out of a single thread, and after you have done so investigate sharing the work across multiple cores, for example with MPI. To get maximum performance in a single thread, one thing I do is single-step it at the machine instruction level, to make sure it's not dawdling about in stuff that could be removed.
一些计算足够规律,足以利用 GPGPU 的优势:最近的显卡本质上是专门的大规模并行数值协处理器。例如,您可以在 OpenCL 中编写数值内核。否则,请学习 C++11 (不是 C++ 标准的某些早期版本)在许多情况下,Ocaml 几乎与 C++ 一样快,但更容易编写代码。
也许您的问题可以通过 scilab 或 R,我不太明白,无法提供更多帮助。
您可以通过使用 Pthreads 或 MPI
最后,Linux 操作系统也许更适合处理大量计算。当今大多数超级计算机都在使用它,这一点意义重大。
Some calculations are regular enough to take profit of GPGPUs: recent graphic cards are essentially specialized massively parallel numerical co-processors. For instance, you could code your numerical kernels in OpenCL. Otherwise, learn C++11 (not some earlier version of the C++ standard) or C. And in many cases Ocaml could be nearly as fast as C++ but much easier to code with.
Perhaps your problem can be handled by scilab or R, I did not understand it enough to help more.
And you might take advantage of your multi-core processor by e.g. using Pthreads or MPI
At last, the Linux operating system is perhaps better to deal with massive calculations. It is significant that most super computers use it today.
如果执行速度是最高优先级,通常意味着 Fortran。
If execution speed is the highest priority, that usually means Fortran.
尝试 Julia:它的杀手功能很容易以高级简洁的方式进行编码,同时保持性能相同的顺序Fortran/C 的大小。
Try Julia: its killing feature is being easy to code in a high level concise way, while keeping performances at the same order of magnitude of Fortran/C.
PARI/GP 是迄今为止我用过的最好的。它是用C写的。
PARI/GP is the best I have used so far. It's written in C.
尝试查看 DMelt 数学程序。该程序调用 Java 库。 Java虚拟机可以为你优化长数学计算。
Try to look at DMelt mathematical program. The program calls Java libraries. Java virtual machine can optimize long mathematical calculations for you.
工程中数学数值运算的标准工具通常是 Matlab(或者作为免费替代品 Octave 或已经提到的 scilab)。
The standard tool for mathmatic numerical operations in engineering is often Matlab (or as free alternatives octave or the already mentioned scilab).