问题描述
有人使用JIT技巧来提高静态编译语言(如C ++)的运行时性能吗?看起来热点分析和基于运行时观察的分支预测可以提高任何代码的性能,但也许有一些基本的战略原因,使得在运行时进行此类观察和实现更改只能在虚拟机中。我清楚地记得窃听的C ++编译器作者你可以做的程序用C ++编写,而听动态语言爱好者谈论收集统计和重新安排代码,但我的网络搜索证据支持这种记忆已经变得干燥。
配置文件引导优化与运行时优化不同。根据分析信息,离线仍然完成优化,但是一旦二进制文件发货,则没有正在进行的优化,因此如果简档引导优化阶段的使用模式没有准确地反映真实世界的使用,则结果将是不完美,而且程序也不会适应不同的使用模式。
您可能会在寻找,虽然该系统专注于本机二进制 - >本机二进制翻译,虽然由于C ++几乎专门编译为本机代码I假设这正是您要找的。 p>
您还可以查看,它是一个支持JIT编译和运行时优化的编译器框架和中间表示,虽然我不确定是否实际上有任何基于LLVM的运行时可以编译C ++和execute + runtime优化它。 p>
Is anyone using JIT tricks to improve the runtime performance of statically compiled languages such as C++? It seems like hotspot analysis and branch prediction based on observations made during runtime could improve the performance of any code, but maybe there's some fundamental strategic reason why making such observations and implementing changes during runtime are only possible in virtual machines. I distinctly recall overhearing C++ compiler writers mutter "you can do that for programs written in C++ too" while listening to dynamic language enthusiasts talk about collecting statistics and rearranging code, but my web searches for evidence to support this memory have come up dry.
Profile guided optimization is different than runtime optimization. The optimization is still done offline, based on profiling information, but once the binary is shipped there is no ongoing optimization, so if the usage patterns of the profile-guided optimization phase don't accurately reflect real-world usage then the results will be imperfect, and the program also won't adapt to different usage patterns.
You may be interesting in looking for information on HP's Dynamo, although that system focused on native binary -> native binary translation, although since C++ is almost exclusively compiled to native code I suppose that's exactly what you are looking for.
You may also want to take a look at LLVM, which is a compiler framework and intermediate representation that supports JIT compilation and runtime optimization, although I'm not sure if there are actually any LLVM-based runtimes that can compile C++ and execute + runtime optimize it yet.
这篇关于运行时优化静态语言:JIT for C ++?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!