len3d

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

11 2012 档案

摘要:I always assume that 'static const' is faster than 'const', while it's actually not the case.From the assembly code generated by VS 2008, 'static const' will generate a dynamic branch to make sure the variable is only initialized once. However, 'const' will genera 阅读全文
posted @ 2012-11-15 16:46 Len3d 阅读(192) 评论(0) 推荐(0)

摘要:I did some tests with the C compiler of Visual Studio 2008, the two methods of dot below made no difference in the generated assembly code:typedefstructVec{floatx,y,z;}Vec;#defineDOT(a,b)(a.x*b.x+a.y*b.y+a.z*b.z)__forceinlinefloatdot(constVec*a,constVec*b){return(a->x*b->x+a->y*b->y+a-&g 阅读全文
posted @ 2012-11-06 14:15 Len3d 阅读(211) 评论(0) 推荐(0)

摘要:http://software.intel.com/en-us/articles/maximum-fps-three-tips-for-faster-codehttp://www.codeproject.com/Articles/6154/Writing-Efficient-C-and-C-Code-Optimizationhttp://leto.net/docs/C-optimization.php 阅读全文
posted @ 2012-11-03 17:53 Len3d 阅读(187) 评论(2) 推荐(0)