Github user davisp commented on a diff in the pull request:

    https://github.com/apache/couchdb-snappy/pull/9#discussion_r225681578
  
    --- Diff: c_src/snappy_nif.cc ---
    @@ -100,6 +94,21 @@ SnappyNifSink::getBin()
     }
     
     
    +void
    +SnappyNifSink::EnsureSize(size_t append_length)
    +{
    +    if((length + append_length) > bin.size) {
    +        size_t sz = append_length * 4;
    --- End diff --
    
    I have no idea why 4 was picked originally but that's not an architecture 
thing I don't think? Its just pre-allocating more space than required so that 
we aren't reallocating for every single append operation. That could be 3 or 5 
or 8,000,000. 


---

Reply via email to