c - 使用诸如 JVM 之类的运行时信息来加快编译程序的速度吗?

标签 c jvm vm-implementation dynamic-analysis

在特定任务中,Java 程序可以胜过 C 等编译型编程语言。这是因为 JVM 具有运行时信息,并在必要时进行 JIT 编译(我猜)。

(示例:http://benchmarksgame.alioth.debian.org/u32/performance.php?test=chameneosredux)

编译型语言有这样的东西吗? (我首先对C感兴趣)

编译源代码后,开发人员运行它并尝试模拟典型的工作负载。 工具收集有关运行的信息,然后根据这些数据再次重新编译。

最佳答案

gcc 有 -fprofile-arcs

来自手册页:

-fprofile-arcs
    Add code so that program flow arcs are instrumented. During execution the 
    program records how many times each branch and call is executed and how many 
    times it is taken or returns. When the compiled program exits it saves this 
    data to a file called auxname.gcda for each source file. The data may be 
    used for profile-directed optimizations (-fbranch-probabilities), or for 
    test coverage analysis (-ftest-coverage).

关于c - 使用诸如 JVM 之类的运行时信息来加快编译程序的速度吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27505148/

相关文章:

c - sizeof 保证位对齐的一个实现

c - 单元格中的 GTK 组合框

c - 可执行文件在编译机上运行,​​而不是在第二台机器上运行

java - 如何摆脱 java.lang.OutOfMemoryError : Java heap space

Java 泛型 Eclipse 编译器错误?

java - 有没有在没有内存开销的情况下在 Java 中存储位?

programming-languages - 字节码设计?

c++ - ODBC 文档清晰度

java - 分支预测: Does avoiding "else" branch for simple operations makes code faster (Java example)?

architecture - BEAM 和 JVM 之间有哪些基本的功能/架构差异?