Redwoood
500+ Head-Fier
- Joined
- Jul 14, 2001
- Posts
- 589
- Likes
- 10
Ctn,
do I understand this correctly?
You have one specific string and want to encode it as efficiently
as possible?
Well, this is different from general compression, where you don't know in advance what you have to compress.
( and in which case you can't do better than log_2(n) if you require a fixed size encoding)
In the constant case (ie constant string -> efficient encodig ) it is absolutely possible to store it in a smaller space. (depending upon the inherent redundancy of this specific string)
What string do you have to encode?
However, keep in mind that in order to find a clever algorithm to
calculate the original string from your 'seed' you introduce a lot of code into your program.
So, let's say you have a 20 byte string, and somehow you bring it down to a 2 byte 'seed', you have to do the 'decoding' in less than 18 + (length of machine code for function call for straight-forward implementation)
so let's say the length ( load registers etc., CALL routine ) is 16 bytes (should be doable)
hence your decoder must be smaller than 34 bytes total machine code length. Otherwise it would be more efficient to save the string itself and use the straight-forward approach.
Bye
Redwoood
do I understand this correctly?
You have one specific string and want to encode it as efficiently
as possible?
Well, this is different from general compression, where you don't know in advance what you have to compress.
( and in which case you can't do better than log_2(n) if you require a fixed size encoding)
In the constant case (ie constant string -> efficient encodig ) it is absolutely possible to store it in a smaller space. (depending upon the inherent redundancy of this specific string)
What string do you have to encode?
However, keep in mind that in order to find a clever algorithm to
calculate the original string from your 'seed' you introduce a lot of code into your program.
So, let's say you have a 20 byte string, and somehow you bring it down to a 2 byte 'seed', you have to do the 'decoding' in less than 18 + (length of machine code for function call for straight-forward implementation)
so let's say the length ( load registers etc., CALL routine ) is 16 bytes (should be doable)
hence your decoder must be smaller than 34 bytes total machine code length. Otherwise it would be more efficient to save the string itself and use the straight-forward approach.
Bye
Redwoood