Coding Practices which enable the compiler/optimizer to make a faster program

后端 未结 30 1885
一个人的身影
一个人的身影 2020-12-02 03:24

Many years ago, C compilers were not particularly smart. As a workaround K&R invented the register keyword, to hint to the compiler, that maybe it woul

30条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-02 04:10

    I've actually seen this done in SQLite and they claim it results in performance boosts ~5%: Put all your code in one file or use the preprocessor to do the equivalent to this. This way the optimizer will have access to the entire program and can do more interprocedural optimizations.

提交回复
热议问题