You missed the point. You can do much, much better. Use the full range of codes. Don't split the code byte into code + value.. Give yourself the full 256 code space.
Have a range of values to specific numbers and one byte ints, two byte ints, up to eight byte ints. Have a set of codes for scaled binary of various length that ibcludes the scalr. Have codes for various lengths of doubles. Don't both with single precision. Have codes for a range if string lengths and for strings with a one byte count, two byte count, etc. Have codes for other types as well. Forget about the difference between char and varchar. Strings are strings. Get rid of traling blanks on fixed strings -- they aren't semantically significant. There should be no need to reference the format objject to decode a value. The only thiings run length encoding is good for are eliminating high order binary zeros on ints, traling binary zeros on double, and traking blanks. The encoding should address all of there. The only advantage run length encoding should have is the ability to combine large numbers of consecutive zero ints. Jim Starkey > On Mar 2, 2015, at 9:35 PM, Slavomir Skopalik <skopa...@elektlabs.cz> wrote: > > Hi all, > after discusion with Jim, I was created frist draft of proposal for > value encoding. > > Pros: efectivity for numerical values including date and time > Cons: poor for strings (can be worst then current), can be solved by > apply RLE (not current) over final result. > > It is designed as simple (there is space for improovement, but general > value distribution function should be know) > and easy to implement. > It is use data from record format to skip length storage where is posible. > > Control byte= code:3bits + Value:5bits > > Code Value Meaning > ===== ======= > 0 > 0 NULL > 1 Float Nan > 2-31 Unused > 1 > 0 Fixed Binary (length comes from record format) > 1-31 Unused > 2 Int5 - (-16~15) from value > 3 Int13 +1byte > 4 Int21 +2bytes > 5 Int29 +3bytes > 6 Int37 +4bytes > 7 Int45 +5bytes > > DataType in format structure: > > INT - stored by absolute value, fixed binary for INT greater > than 2^45 > VARCHAR - int (length) + bytes[lenght] > CHAR - VARCHAR + fill space > DATE - Value-'1.1.2016' stored as int (nuber of days) > TIME - Time - '12:00:00' PM (noon) and stored as INT (what is > requested precision?) > TIMESTAMP - as DATE followed by TIME > FLOAT - integer value stored as integer, else Fixed binary (4) > DOUBLE PRECISION - integer value stored as integer, else Fixed binary (8) > DECIMAL - Stored as INT > BLOBID - stored as integer > > > Record format: > uint32 tr_id > uint8 format > <data> > > > Any comments? > > Slavek > > -- > Ing. Slavomir Skopalik > Executive Head > Elekt Labs s.r.o. > Collection and evaluation of data from machines and laboratories > by means of system MASA (http://www.elektlabs.cz/m2demo) > ----------------------------------------------------------------- > Address: > Elekt Labs s.r.o. > Chaloupky 158 > 783 72 Velky Tynec > Czech Republic > --------------------------------------------------------------- > Mobile: +420 724 207 851 > icq:199 118 333 > skype:skopaliks > e-mail:skopa...@elektlabs.cz > http://www.elektlabs.cz > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for all > things parallel software development, from weekly thought leadership blogs to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > Firebird-Devel mailing list, web interface at > https://lists.sourceforge.net/lists/listinfo/firebird-devel ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel