-
Notifications
You must be signed in to change notification settings - Fork 54
Closed
Milestone
Description
I ran a profiling test which showed that calloc is the top CPU consumer. I saw in density_allocate_context, there is a line:
memset(context->dictionary, 0, context->dictionary_size);
(It turned out that gcc optimized the combination of x=malloc(y) and memset(x,0,y) into single calloc(x) call.)
So the problem was that every time I use the compress or decompress routine, density must clear (1<<16)*(2+1)*4 = 786432 bytes. That is quite a burden for all machines.
I see there is a density_compress_with_context function which seems to allow a pre-allocated context to be used by multiple times, but since the dictionary inside the context has been changed, the output (compressed buffer) cannot be decompressed correctly.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels