Two points - STL, and multi-threading

* About STL : never trust its performance too much

STL is a standard now. You cannot avoid it ever. People trust it a lot, but keep it in mind: STL is not as good as you think of it. First, you have to know its internal implementation, or you'll make mistakes. As std::map, you can never change its key value because it takes a binary tree as its cardinal structure. Second, it's performance is not that good. Well, this is the issue by design. STL focuses on general issues, so if you have strict perf. constraints in your app, you'd better write your own stuff.

* Multi-threading : sometimes ostrich algorithm is the best solution

If you've got a damn shared data under a multi-threading environment, you may be troubled by it if you have little multi-threading dev. experience. Maybe your first idea is to add locks to the shared data or sth else. But not so long you will be confused by the complex logics of your code. Maybe you'll harvest dead lock, maybe the data is still shared orderlessly. When you got tired, you must be complaining that why there's such shared data?! Yes, the answer is your complaint words: Just remove the shared data~! It's ostrich algorithm, it's too simple to make it an algorithm, but it works. What's the most important: it can save your time a lot~!

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值