Recent Posts
-
June 01, 2014
Gcc的链接选项 Llibrary 执行链接库是有顺序的
下载LOFTER我的照片书 |编译程序时,发现一个奇怪的错误,明明有 -lz 指定了 zlib的链接库了。就是找不到zlib里面函数。原来是因为 *.o *.a写在 -lz的后面了。 这恶 -l选项指定库时是有顺序的。 只对它前面的那些 *.o文件起作用。参考https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html-llibrary-l librarySearch the library named library when...
-
May 28, 2014
Lua代码性能优化之追加元素到数组结尾的写法
http://lua-users.org/wiki/OptimisationCodingTipsLua Performance Tipshttp://www.lua.org/gems/sample.pdf根据这里面常用的优化方式,1.比如使用local变量,避免直接引用global变量的多级hash查找等。甚至如果循环里面的引用各个模块的函数,都要在循环之前用本地变量先cache一下,因为在Lua里面函数也是table,也需要查找。比如,local table_insert = t...
-
May 28, 2014
Lua性能优化之c++ std sort替换table sort (luajit的ffi使用c代码的例子)
-- require('mobdebug').start("192.168.56.1")local os = require "os"local math = require "math"local string = require "string"local socket = require "socket"--[[Example:local statsd = require "statsd"local s = statsd.metric:new{name = "haha"}...
-
May 23, 2014
Int和float溢出的问题(转)
下载LOFTER我的照片书 |PERFECT PREVENTION OF INT OVERFLOWShttp://forrestthewoods.ghost.io/perfect-prevention-of-int-overflows/float的精度问题,导致它在表达比较大的数值时,误差比较大,比如1,000,000,000 这个数值时,精度误差就达到64了。int和float溢出的问题(转) - widebright - widebright的个人空间文章是说int 用来表示时间的秒...
-
May 22, 2014
Lua,statsd ,graphite和实时监控可视化
很早之前就看到这篇文章Measure Anything, Measure Everythinghttp://codeascraft.com/2011/02/15/measure-anything-measure-everything/所以那时就玩了一会Graphite,用c++ 写了一个Graphite的前端,把数据推送给它。但那时觉得Statsd也是一个Graphite前端,又是node.js的,觉得安装起来又要多花点时间,就没去看。最近我们组用到lua,我打算边学习lua边写一个简单的...
-
May 21, 2014
Linkedin的分享optimizing linux memory management for low Latency & high Throughput databases
Optimizing Linux Memory Management for Low-latency / High-throughput Databaseshttp://engineering.linkedin.com/performance/optimizing-linux-memory-management-low-latency-high-throughput-databases'禁用内核里面zone reclaim ,可以获得巨大的性能提升Linux's NUMA optimiza...
-
May 07, 2014
Andrei alexandrescu three optimization tips for c++提到一个格式化数字为字符串的优化
Andrei Alexandrescu "Three Optimization Tips for C++"网上可以找到这个演示,里面提到了几种优化办法,不过都被墙了,下面这个页面也有点介绍https://m.facebook.com/notes/facebook-engineering/three-optimization-tips-for-c/10151361643253920提到的优化技巧:Prefer static linking and position-dependent cod...
-
May 06, 2014
Linux netfiler修改http包内容,长度改变时还要修改http包的content Length和 chunk size才行
来源http://bbs.chinaunix.net/thread-4137351-1-1.html很早之前试过用__nf_nat_mangle_tcp_packet来修改TCP包,好像修改是http的url。但修改http包的网页内容时,长度改变之后,是还需要修改一下http协议里面对应的content-length和 chunk size才行。chinaLinux的网友测试的看他那些写的结果是这样。图片来自该帖子,wireshark里面查看需要修改几个属性。这个很邪恶的功能啊,以后的网...
-
April 28, 2014
Debian debug package调试符号包相关的一些资料
下载LOFTER我的照片书 |man dh_striphttps://wiki.debian.org/DebugPackage用这个命令生成那些debian debug package的吧 -----------------man strip --only-keep-debug 1.<Run "objcopy --only-keep-debug foo foo.dbg" to> create a file con...
-
April 28, 2014
Linux平台的mktime localtime gmtime timegm函数和windows的实现比较linux平台的
(gdb) bt#0 __localtime_r (t=0xb7376880, tp=0xb737684c) at localtime.c:33#1 0xb74f12db in ranged_convert (convert=<optimized out>, t=<optimized out>, tp=0xb737684c) at mktime.c:233#2 0xb74f159c in __mktime_internal (tp=0xb73768f4...