[Compression] Accenerate the encoding of variable length strings.
[Compression] Accenerate the encoding of variable length strings.

Before this commit we allocated a large bitstream and we kept shifting
and adding new bits every iteration.

With this commit we'll keep growing the APInt right before we insert new bits.
This makes the first iterations very efficient because the bitstream is small,
and the last iterations slightly better then the previous implementation
(because our initial estimate for bitstream size is conservative).

khizkhiz/swift,khizkhiz/swift,khizkhiz/swift,khizkhiz/swift,khizkhiz/swift,khizkhiz/swift,khizkhiz/swift