RLE for Automate

by NiX

Version 3 (May 23, 2024)

Download (21 downloads)

Brought to you by: NiX

This flow is an implementation of Run Length Encoding and Decoding in Automate

Yes, it may be unoptimized and/or messy, but hey it works, if you can optimize it feel free to do so, or tell me about it in the comments, i'll make sure to update it with optimizations proposed, but before doing that, check if it was already proposed or done by someone

So, "what is RLE?" I hear you ask
Now, there's two ways to go about it:

1. Watch this video: https://youtu.be/aF1Yw_wu2cM?t=5m40s by Retro Game Mechanics Explained from 5:40 until 18:29, his explanation in the video uses binary system and Pokémon sprites as an example for showing how the algorithm works

Or:

2. Read my condensed explanation below(however watching the video is recommended)

The choice is up to you

Now to the explanation if you've chosen to go with option 2:

RLE, or Run Length Encoding is a compression algorithm, best suited for highly repetitive data, it is usually used to compress binary files with lots of 0s & 1s, however hexadecimal and even text can be compressed this way as well(and this implementation works only with text, not binary!)

However, RLE has one downside, it's awful for rarely or not at all repetitive data, in which case this algorithm will actually increase size of(or inflate) the data(compression rate >1)

Examples:
Repetitive data:
A string of 100 letters "a"
Will be compressed to a few symbols, namely the delimiter, the letter, and the amount of consecutive letters
In this example, the compression rate is 0.05(5% space is used by the compressed data opposing the original data, as the algorithm has reduced 100 symbols, to just 5)

Non-repetitive data:
A string of 100 random letters
At best, it might catch stray double letters, but let's assume there is none, for the sake of example
So, the algorithm will inflate the data(increase its size) to 300 symbols, each letter, gets the delimiter and a 1(no consecutively repeating characters), and for each character it's 200 symbols on top of 100 we already have
In this case, the compression rate is 3(300% space used compared to original data, algorithm increased the amount of symbols from 100 to 300)

5.0 average rating from 1 reviews

5 stars
1
4 stars
0
3 stars
0
2 stars
0
1 star
0
Reports
0

Rate and review within the app in the Community section.