wafflesfm / batter

It makes Waffles.
Other
84 stars 17 forks source link

Torrent pieces should be stored as binary #5

Open ghost opened 11 years ago

ghost commented 11 years ago

In https://github.com/wafflesfm/batter/blob/develop/batter/torrents/views/upload.py#L68

t['info']['pieces'] = binascii.hexlify(t['info']['pieces'])

It would be much more efficient to just store this as binary, and if a textual representation is needed later just to convert it on the fly. I know that Django doesn't have a built-in thing for this, but IMO it's worth having to specialize some of the DB stuff to reduce the size by half. Comments regarding this @Ell?

If for some reason this isn't possible, at least base64 or better should be used.

edgewyn commented 11 years ago

Django has a BinaryField coming Soon™ (it's marked "Ready for checkin" on their issue tracker). In the meantime, I think storing the piece hash as a hex representation is fine.

ghost commented 11 years ago

Cool, we can just wait for that then. I'll leave this issue open so that we remember to do this in the future.