Re: zram: Optimize LZ4 dictionary compression performance
From: Sergey Senozhatsky
Date: Wed Mar 11 2026 - 01:23:44 EST
On (26/03/11 04:00), gao xu wrote:
> > On (26/03/10 02:54), gao xu wrote:
> > > + memcpy(zctx->cstrm, &drv->base_cstream,
> > > + sizeof(*zctx->cstrm));
> >
> > Do we need to do this memcpy() every time?
> memcpy is a replacement for LZ4_loadDict. LZ4_loadDict updates
> the LZ4 hash table using the dictionary. Furthermore, LZ4 also
> updates its hash table with the results of the previous compression.
> Therefore, to ensure the compression dictionary remains effective, we
> would need to reset the hash table every time, which would involve
> executing memcpy() or LZ4_loadDict()
OK, I see. (I assume you tested and verified that.)