[encoder] replace vector by hash table and mempool (perf)