-
Notifications
You must be signed in to change notification settings - Fork 721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zlog的性能瓶颈问题 --- the speed's bottleneck of zlog problem, any help? #3
Comments
试图自己写代码替换strftime,结果发现vfprintf的调用开销增加,看来GNU的大爷们实现的很不错!本问题关闭 |
原因可能是这个:http://stackoverflow.com/questions/8174147/strftime-performance-vs-snprintf |
呃,谢谢支持,那个链接我看过了,现在我优化了,缓存结果,如果两次的格式一样,每秒调用strftime一次,大大提高效率 to PS2: git上的版本还在开发中,昨天的版本有些问题……包括16进制输出等 格式串参数长的时候有问题?等新版本有问题再看吧。。在我的test/test_conf.conf里面 date = "date start%n%d(%a--Wed)%n%d(%A--Wednesday)%n%d(%b--Mar)%n%d(%B--March)%n%d(%c--WedMar211:45:262011)%n%d(%C--20)%n%d(%d--02)%n%d(%D--03/02/11)%n%d(%e--2)%n%d(%F--2011-03-02)%n%d(%g--11)%n%d(%G--2011)%n%d(%h--Mar)%n%d(%H--11)%n%d(%I--11)%n%d(%j--061)%n%d(%k-k)%n%d(%l-l)%n%d(%ms--500)%n%d(%m--03)%n%d(%M--45)%n%d(%us--500730)%n%d(%p--AM)%n%d(%r--11:45:26AM)%n%d(%R--11:45)%n%d(%s--epoch)%n%d(%S--26)%n%d(%t--)%n%d(%T--11:45:26)%n%d(%u--3)%n%d(%U--09)%n%d(%V--09)%n%d(%w--3)%n%d(%W--09)%n%d(%x--03/02/11)%n%d(%X--11:45:26)%n%d(%y--11)%n%d(%Y--2011)%n%d(%z--+0800)%n%d(%Z--CST)%n%d(%%--%)%n%d(%J--%J)%ndate end%n" 都可以。 to PS1: 这是valgrind的callgrind结果,用kcachegrind查看 |
可以考虑转为struct tm,然后自己snprintf,比strftime快太多了 |
zlog的性能一直在提高
the speed of zlog get up and up through every version:
不过最大的瓶颈,在linux操作系统上,还是strftime,见图
But The biggest bottleneck on my Linux 2.6.32-41 is strftime, see pic
在aix就没有这个问题
On Aix 5.3, there is no such problem
不知大家有没有什么好的办法来解决这个问题?
Any one knows is there a way to solve this problem?
The text was updated successfully, but these errors were encountered: