1. 29 Dec, 2017 1 commit
    • Oran Agra's avatar
      fix processing of large bulks (above 2GB) · 60a4f12f
      Oran Agra authored
      - protocol parsing (processMultibulkBuffer) was limitted to 32big positions in the buffer
        readQueryFromClient potential overflow
      - rioWriteBulkCount used int, although rioWriteBulkString gave it size_t
      - several places in sds.c that used int for string length or index.
      - bugfix in RM_SaveAuxField (return was 1 or -1 and not length)
      - RM_SaveStringBuffer was limitted to 32bit length
      60a4f12f
  2. 03 Nov, 2017 1 commit
    • antirez's avatar
      SDS: improve sdsRemoveFreeSpace() to avoid useless data copy. · 34d5804d
      antirez authored
      Since SDS v2, we no longer have a single header, so the function to
      rewrite the SDS in terms of the minimum space required, instead of just
      using realloc() and let the underlying allocator decide what to do,
      was doing an allocation + copy every time the minimum possible header
      needed to represent the string was different than the current one.
      This could be often a bit wasteful, because if we go, for instance, from
      the 32 bit fields header to the 16 bit fields header, the overhead of
      the header is normally very small. With this commit we call realloc
      instead, unless the change in header size is very significant in relation
      to the string length.
      34d5804d
  3. 01 Sep, 2016 1 commit
  4. 09 May, 2016 1 commit
  5. 17 Nov, 2015 1 commit
    • antirez's avatar
      Lua debugger: use sds_malloc() to allocate eval cli array. · e57cccde
      antirez authored
      Redis-cli handles the debugger "eval" command in a special way since
      sdssplitargs() would not be ok: we need to send the Redis debugger the
      whole Lua script without any parsing. However in order to later free the
      argument vector inside redis-cli using just sdsfreesplitres(), we need
      to allocate the array of SDS pointers using the same allocator SDS is
      using, that may differ to what Redis is using.
      
      So now a newer version of SDS exports sds_malloc() and other allocator
      functions to give access, to the program it is linked to, the allocator
      used internally by SDS.
      e57cccde
  6. 25 Jul, 2015 4 commits
  7. 24 Jul, 2015 1 commit
  8. 23 Jul, 2015 1 commit
    • antirez's avatar
      SDS: use type 8 if we are likely to append to the string. · ea9bd243
      antirez authored
      When empty strings are created, or when sdsMakeRoomFor() is called, we
      are likely into an appending pattern. Use at least type 8 SDS strings
      since TYPE 5 does not remember the free allocation size and requires to
      call sdsMakeRoomFor() at every new piece appended.
      ea9bd243
  9. 20 Jul, 2015 1 commit
  10. 15 Jul, 2015 1 commit
    • antirez's avatar
      SDS: New sds type 5 implemented. · 0ab27a45
      antirez authored
      This is an attempt to use the refcount feature of the sds.c fork
      provided in the Pull Request #2509. A new type, SDS_TYPE_5 is introduced
      having a one byte header with just the string length, without
      information about the available additional length at the end of the
      string (this means that sdsMakeRoomFor() will be required each time
      we want to append something, since the string will always report to have
      0 bytes available).
      
      More work needed in order to avoid common SDS functions will pay the
      cost of this type. For example both sdscatprintf() and sdscatfmt()
      should try to upgrade to SDS_TYPE_8 ASAP when appending chars.
      0ab27a45
  11. 14 Jul, 2015 1 commit
  12. 20 Apr, 2015 2 commits
  13. 19 Apr, 2015 1 commit
  14. 08 Jan, 2015 1 commit
  15. 02 Jan, 2015 1 commit
    • Matt Stancliff's avatar
      Add sdsnative() · e1619772
      Matt Stancliff authored
      Use the existing memory space for an SDS to convert it to a regular
      character buffer so we don't need to allocate duplicate space just
      to extract a usable buffer for native operations.
      e1619772
  16. 23 Dec, 2014 1 commit
    • Matt Stancliff's avatar
      Allow all code tests to run using Redis args · 8febcffd
      Matt Stancliff authored
      Previously, many files had individual main() functions for testing,
      but each required being compiled with their own testing flags.
      That gets difficult when you have 8 different flags you need
      to set just to run all tests (plus, some test files required
      other files to be compiled aaginst them, and it seems some didn't
      build at all without including the rest of Redis).
      
      Now all individual test main() funcions are renamed to a test
      function for the file itself and one global REDIS_TEST define enables
      testing across the entire codebase.
      
      Tests can now be run with:
        - `./redis-server test <test>`
      
        e.g. ./redis-server test ziplist
      
      If REDIS_TEST is not defined, then no tests get included and no
      tests are included in the final redis-server binary.
      8febcffd
  17. 11 Dec, 2014 2 commits
  18. 10 Dec, 2014 2 commits
    • antirez's avatar
      sds.c: more tests for sdstrim(). · 9bb4ef87
      antirez authored
      9bb4ef87
    • Brochen's avatar
      Update sds.c · 181300d4
      Brochen authored
      in the case (all chars of the string s found in 'cset' ),
      line[573] will no more do the same thing line[572] did.
      this will be more faster especially in the case that the string s is very long and all chars of string s found in 'cset'
      181300d4
  19. 03 Nov, 2014 1 commit
  20. 02 Nov, 2014 2 commits
  21. 29 Sep, 2014 2 commits
  22. 25 Aug, 2014 1 commit
  23. 13 Aug, 2014 1 commit
  24. 12 Aug, 2014 1 commit
  25. 26 Jun, 2014 1 commit
  26. 23 Jun, 2014 1 commit
  27. 28 Apr, 2014 2 commits
    • antirez's avatar
      Added new sdscatfmt() %u and %U format specifiers. · 2d76736a
      antirez authored
      This commit also fixes a bug in the implementation of sdscatfmt()
      resulting from stale references to the SDS string header after
      sdsMakeRoomFor() calls.
      2d76736a
    • antirez's avatar
      sdscatfmt() added to SDS library. · 53575c47
      antirez authored
      sdscatprintf() relies on printf() family libc functions and is sometimes
      too slow in critical code paths. sdscatfmt() is an alternative which is:
      
      1) Far less capable.
      2) Format specifier uncompatible.
      3) Faster.
      
      It is suitable to be used in those speed critical code paths such as
      CLIENT LIST output generation.
      53575c47
  28. 24 Mar, 2014 2 commits
    • antirez's avatar
      sdscatvprintf(): Try to use a static buffer. · 30639c8c
      antirez authored
      For small content the function now tries to use a static buffer to avoid
      a malloc/free cycle that is too costly when the function is used in the
      context of performance critical code path such as INFO output generation.
      
      This change was verified to have positive effects in the execution speed
      of the INFO command.
      30639c8c
    • antirez's avatar
      sdscatvprintf(): guess buflen using format length. · a9caca04
      antirez authored
      sdscatvprintf() uses a loop where it tries to output the formatted
      string in a buffer of the initial length, if there was not enough room,
      a buffer of doubled size is tried and so forth.
      
      The initial guess for the buffer length was very poor, an hardcoded
      "16". This caused the printf to be processed multiple times without a
      good reason. Given that printf functions are already not fast, the
      overhead was significant.
      
      The new heuristic is to use a buffer 4 times the length of the format
      buffer, and 32 as minimal size. This appears to be a good balance for
      typical uses of the function inside the Redis code base.
      
      This change improved INFO command performances 3 times.
      a9caca04
  29. 12 Dec, 2013 1 commit
  30. 05 Dec, 2013 1 commit