4meta5 / huffman-codec

lossless compression via huffman codes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

misc optimizations

4meta5 opened this issue · comments

will address when I feel like it, code is already clean now

  • remove CharDNEinDict and make char conversion infallible, use 1i32
  • use hashbrown::HashMap instead of BTreeMap
  • look into using lifetimes instead of Rc
  • map -> heap -> tree can definitely be improved to remove like 2-3 allocations per element per step

You could use an array of Option<u8> for all ascii characters and then for any others use a HashMap

lifetimes with a tree would probably be impossible however you could have the root node store a vector of each node and then instead of Rc use a index into the roots vector

lifetimes with a tree would probably be impossible however you could have the root node store a vector of each node and then instead of Rc use a index into the roots vector

Interesting, I'd like to see this and compare benchmark results.