Data Compression as Fast As Possible
Techquickie
·Techquickie
·2015-05-07
·
1,045 words · ~5 min read
0:00
anyone who's ever had to pack for a trip has probably known the frustration of
0:04
trying to cram almost a suitcase worth of stuff into a backpack I mean sure we
0:11
could suck it up and leave a few items behind or haul around our bulky luggage
0:15
with us if they're so important but if we did that then our bag won't fit in
0:20
the overhead compartment anyway and all we're trying to bring is a few extra
0:24
pairs of underwear just in case we eat some bad tandoori chicken well that got
0:30
gross but other than that was pretty much a perfect analogy for why data
0:34
compression became so important to reduce storage requirements and to
0:39
improve transfer speeds over standard connections these packaging services are
0:44
kind of like our roommate who catches us standing on our bag trying to zip it up
0:48
and says you know you uh can just roll
0:52
your laundry and save like a ton of space right and as it turns out when we
0:56
try it for ourselves the smug little turd is right not only does all of our
1:00
stuff now fit but we even have more room to cram with stuff we'll never use like
1:05
that copy of ET the Extraterrestrial that we definitely don't watch every
1:08
night and cry back on topic obviously
1:11
data can't be rolled in quite the same manner as slightly pre-worn laundry so
1:15
coding Engineers devise algorithms capable of breaking down longer strings
1:19
of data into shorter ones then reassembling them later using what
1:23
they've retained an easy way to describe this would be like breaking down the
1:27
equation 2 * 2 * 2 2 * 2 * 2 into 2 to
1:32
the 5th power which is much faster to write and simpler to articulate but lus
1:37
I actually know a thing or two about coding and uh one of those things is
1:41
that the use of exponential symbols is simply not possible well first off
1:45
thankfully we weren't roommates in college I mean talk about smug second
1:49
you're correct as well while it is possible to write a command string which
1:53
describes an exponential function it usually isn't much of a space saver so
1:57
maybe a better way to demonstrate how a compress algorithm works is to use
2:01
something like a string of x's and o's or zeros and ones if you're catching the
2:06
similarities here let's say we have a string of eight digits which is spelled
2:09
out as XXX o XXX now an algorithm may
2:13
look at this and decide that every time it comes across a new digit it will
2:16
replicate it and then note how many times it's been repeated this would
2:20
cause our string to transform into the smaller x302 X3 while this did reduce
2:26
overall size it only managed to do so by 25% which which isn't exactly going to
2:30
allow us to cram our drives full or transfer large files over the Internet
2:35
more efficiently that's where more specifically designed algorithms will
2:39
come in to strip the code to its most basic form instead simply adding all the
2:44
X's together by treating each as a value of one then listing all the O's followed
2:49
with a digit count as before then we end up with a string that would look like
2:53
3023 which we can now see as half the size of the original code now obviously
2:58
this example is rudimentary at best but it gives an idea of how mathematicians
3:03
are able to achieve and then further improve upon this feat as time goes on
3:07
now this example would be known as lossless compression all of the original
3:12
data remains intact and is a requirement
3:16
for programs or documents but if you're
3:19
willing to give up some detail in the original file lossy compression
3:24
algorithms can be used for media files like music and movies as long as you
3:28
understand that the tighter you cram it the lower the playback quality you'll
3:32
experience which you can actually learn a little bit more about here in our
3:35
video specifically about video compression speaking of compression no
3:42
no not compression okay whatever we've got a new sponsor today on Techquickie
3:45
freshbooks it's a cloud Accounting Service and basically the kind of thing
3:50
that any freelance worker or small business is going to want to know about
3:54
it's all about making your life easier when it comes to invoicing getting paid
3:58
and tracking expens expenses because it's done online it makes invoicing
4:03
simple your clients can pay you online your expenses are automatically tracked
4:06
as you spend and all the little details about cash flow are all in one place so
4:10
you know exactly where you stand and it shows a full history of every invoice
4:14
and allows you to check if your client has viewed the invoice and all kinds of cool stuff like that you can even update
4:18
your freshbooks time sheet from your phone and pull project hours right into
4:22
an invoice so you can send that off so you get paid if you're Your Own Boss you
4:26
should be using stuff that makes you feel like a boss and fresh books is an
4:29
incredibly easy way of doing all of your billing online so you'll have more time
4:33
to do the work you actually want to be doing or maybe you don't want to be
4:37
doing it maybe you just need to do it to eat or whatever the case may be to do
4:41
your work head over to freshbooks.com tequ and don't forget to enter
4:45
techquickie in the how did You Hear About Us section because that's
4:50
important all right thanks guys for watching this video like it if you liked
4:54
it dislike it if you thought it sucked check out our other channels Linus Tech
4:57
tips and Channel Super Fun where we do super fun stuff comment on the video
5:01
with suggestions for future videos and as always don't forget to subscribe slf
5:06
follow and all that good stuff if you want to see more videos just like this
5:09
one