You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
main buffer defined as char buffer[1024*1024];
and the only place it accessed is append_to_buffer() - generate-cat-file.c @ 109
however, inside the buffer is accessed only on write pass, else - just check of its size not exceeded
but why? you can achieve more dynamic behaviour in term of buffer size by these few actions
ommit buffer size check in append_to_buffer() or move it under write=true condition
in addition you can add size limitation just before allocation.
also you can optimize encode_sequence() (or all similar functions) to something like
//this code is from previous iteration of my version, based on yoursize_tencode_sequence(void*s, size_ta_fn(void*, bool), boolwrite)
{
size_tlen=a_fn(s, false);
size_tl2=encode_tag_and_length(SEQUENCE_TAG, len, write);
if (write)
returna_fn(s, write) +l2;
returnlen+l2;
}
so encode_sequence(p, f, false) will be faster and cheaper, cuz there will be no useless run on write=false, that anyway would have been checked inside append_to_buffer()
ideally no function should reach append_to_buffer() on write=false
The text was updated successfully, but these errors were encountered:
Hi this sounds very interesting. Having a fixed size buffer is probably a bad
idea because one could specify 1000+ files to encode. Are you already working
on a patch? I think it shouldn't be that hard to implement but on the other hand
it is also not that urgent (have to drop now).
not exactly... i altered you work in sligtly different direction, but partially this optimization implemented. Described part should be easy and done soon, but no any ETA, i assume that i'll create a PR when it's done
main buffer defined as
char buffer[1024*1024];
and the only place it accessed is append_to_buffer() - generate-cat-file.c @ 109
however, inside the buffer is accessed only on write pass, else - just check of its size not exceeded
but why? you can achieve more dynamic behaviour in term of buffer size by these few actions
append_to_buffer()
or move it under write=true conditionchar *buffer;
buffer = (char*)malloc(buffer_sz)
in addition you can add size limitation just before allocation.
also you can optimize
encode_sequence()
(or all similar functions) to something likeso encode_sequence(p, f, false) will be faster and cheaper, cuz there will be no useless run on
write=false
, that anyway would have been checked insideappend_to_buffer()
ideally no function should reach
append_to_buffer()
on write=falseThe text was updated successfully, but these errors were encountered: