6 ms·
Probably the most useful observation in the article is hidden right before the Results / Conclusion... Any optimization should be measured. Otherwise how do yo
by sounds 14y ago
Probably the most useful observation in the article is hidden right before the Results / Conclusion...
Any optimization should be measured. Otherwise how do you know if all your hard work is worth it? In the author's example, the fastest implementation was actually _not_ lock-free, it merely used a better spinlock than std::mutex.
It's a good idea to use existing implementations mostly so that you can measure and (hopefully without too much trouble) change out the implementation whenever you need to. Different hardware likely has different performance, so measure often!
- pacaro 14y agoLike the old carpenters adage "Measure twice, cut once"
- niggler 14y agoLike the old programmers adage "Days of programming save hours of planning"
- tlarkworthy 14y agoWe recently bought a laser cutter and realised that adage is based on the assumption that the cutting takes the longest time. Now if we want a really good fit we do a binary search on the cut dimensions. Our new laser cutter adage is "cut loads and don't bother measuring because it doesn't take into account the size of your cut"
- throwaway54-762 14y ago> In the author's example, the fastest implementation was actually _not_ lock-free, it merely used a better spinlock than std::mutex. The author is also using gcc 4.6; perhaps different results would be obtained with gcc 4.8 or recent Clang. If you care enough to think about LFDS, measure measure measure =).
- ajross 14y agoOr glibc's pthread_mutex_t implementation. Or hand-written assembly above futex(2). There's no lack of synchronization primitives.