在特定任务中,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/