You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All the characters in code_table.rs are in the Basic Multilingual Plane, i.e. they fit in a u16 (and I don't think that this will ever change in the future).
The [char; 128] arrays could be replaced with u16 arrays to cut their size in half. Currently, all the decoding tables are 512 bytes in size which is quite large.
If you replace the [Option<char>; 128] arrays with [Option<u16>; 128] arrays however, that wouldn't save any space. Maybe an encoding with a special sentinel value of 0xFFFF could be chosen here to make these arrays smaller too.
I know that all of this would make the tables harder to use. Maybe the tables themselves should be hidden inside public functions that do the mapping. Or you define a new type like CompleteDecodeTable([u16; 128]); and give people accessor methods.
The encoding tables can probably be made smaller too (and could be hidden inside public functions) but I didn't look into that.
The text was updated successfully, but these errors were encountered:
I've exposed too much of the tables, so it'll be a breaking change to change the internal structure of the tables.
We probably have to wrap the raw tables into structures.
Also, additional type conversions (2 bytes u16 ↔ 4 bytes char) will be newly required. We have to perform microbench to assure the changes won't make the code too slower.
All the characters in
code_table.rs
are in the Basic Multilingual Plane, i.e. they fit in au16
(and I don't think that this will ever change in the future).The
[char; 128]
arrays could be replaced withu16
arrays to cut their size in half. Currently, all the decoding tables are 512 bytes in size which is quite large.If you replace the
[Option<char>; 128]
arrays with[Option<u16>; 128]
arrays however, that wouldn't save any space. Maybe an encoding with a special sentinel value of0xFFFF
could be chosen here to make these arrays smaller too.I know that all of this would make the tables harder to use. Maybe the tables themselves should be hidden inside public functions that do the mapping. Or you define a new type like
CompleteDecodeTable([u16; 128]);
and give people accessor methods.The encoding tables can probably be made smaller too (and could be hidden inside public functions) but I didn't look into that.
The text was updated successfully, but these errors were encountered: