Ivan Kruglov
unread,Nov 9, 2014, 10:19:18 AM11/9/14Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to serea...@googlegroups.com
Hi all,
With my latest set of commits (db8818c, 9aefc64, e2062d9, eaea8d0,
db540ef) I refactored Sereal::Encoder allowing easy of reuse the code in
Sereal::Merger.
Here is a summary of what was done:
a) all buffer-related functions and macros in srl_buffer.h takes
srl_buffer_t* as parameter instead of srl_encoder_t*. Sereal::Encoder
and Merger's code are updated accordingly and the updates mostly are
replacing "enc" with "&enc->buf". Introduced extra level of indirection
when accessing buffer's fields didn't cause any noticeable implication
on performance in my tests. For the test results check commit message to
db8818c.
b) compression logic (and associated functions) are split into
srl_compress.h.
The signature of compression function:
void srl_compress_body(pTHX_ srl_buffer_t *buf, STRLEN sereal_header_length, const U8 compressor, const int compress_level, void **workmem);
The function uses the same macros (SRL_F_COMPRESS_SNAPPY,
SRL_F_COMPRESS_SNAPPY_INCREMENTAL, SRL_F_COMPRESS_ZLIB) for different
compression formats.
c) Sereal::Merger employs srl_compress.h
Any suggestions/comments welcome!
Regards,
Ivan Kruglov.