Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Black-White Array: fast, ordered and based on with O(log N) memory allocations (github.com/dronnix)
13 points by platzhirsch 4 hours ago | hide | past | favorite | 2 comments
 help



The best optimization is to know how big the array will be before you add any elements at all. Use Reserve. Then you completely avoid any intermediate arrays and copying. And in the case of C++, you avoid mass copy construction for classes without move constructors.

You accidentally the word arrays



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: