新设计的T-shirt
成品印好了,可惜袖子稍微大了点。 
今天写了一个小程序测试了一下在windows系统上不同内存分配方式间的性能差异,比较内容:VirtualAlloc,malloc,new,和HeapAlloc。代码很简单,循环分配并释放内存,最后计算每种方法所耗用的时间。
测试结果:
Virtual Memory total time:125,kernel:125,user:0
new total time:203,kernel:171,user:31
malloc total time:125,kernel:125,user:0
heap total time:125,kernel:109,user:15
Press any key to continue . . .
代码:
June 6th, 2006 in Windows | 2 comments
最近需要一个高性能的hash实现,对比了很多实现hash表的源代码,主要区别在于冲突检测的实现方式。
关于冲突检测的两种方式的对比(chaining and open addressing):
http://www.absoluteastronomy.com/enc1/hash_table
Google有一个高效的实现Open addressing hash 的开源项目
http://goog-sparsehash.sourceforge.net/
Open addressing的性能可能会更好些,但是前提是需要一个非常好的hash生成算法。如果使用Chaining方式,加上一个非常高效的memory pool管理,减少cache失效时间,平均性能应该和Open addressing差不多。
June 5th, 2006 in Programming | No comments yet
As you know, new/delete operations take a lot of CPU time. If you work with servers, CPU time is important. If additional memory is added to the server, then the servers’ available memory size will grow in a linear fashion.
So Log Microscope has it’s own efficient memory management system. CFastMemoryPool is the one of them for LogMicroscope@35. because I never need to delete the instance,so a single call to Shrink() will free all memory allocated.it’s extreme fast,enjoy it!
June 3rd, 2006 in Programming | 1 comment