Reimplementing red-black tree data structure, which exist in WINGs, but heavily underused, I've found one funny optimization. Everyone is starting with classical rotate_left and rotate_right functions, and they're updating root node on every rotation. That causes more checks and assignments than required in some cases. Solution is simple as always: tree rotation functions can be simplified by factoring out code for setting root node.
I must admit that this particular code is pretty good in WINGs. There's only a little space for improvement. And it makes me wonder why those beautiful trees weren't used for example in implementing hash tables. Hash tables in WINGs are simple arrays of pairs, and it's really possible to speed them up a lot.
I'm looking at savannah. It's most likely, that I host nexmaker project there.
I must admit that this particular code is pretty good in WINGs. There's only a little space for improvement. And it makes me wonder why those beautiful trees weren't used for example in implementing hash tables. Hash tables in WINGs are simple arrays of pairs, and it's really possible to speed them up a lot.
I'm looking at savannah. It's most likely, that I host nexmaker project there.
No comments:
Post a Comment