@LiquidBoy:

I don't see code one to be that bad. Sure it takes more memory, but it is done only one time. There is one extra indirection though.

problem is, it gets worse if you repeat split down the road.

it is not something to do with managed vs unmanaged. You get the same problem with any language. Anyway, a side note, it should get an array of indexs on code two. You can get shallow call stack and multithreading for doing that.