[dovecot/core] 62219b: lib-index: Memory allocation optimization

GitHub noreply at github.com
Fri Apr 29 11:30:15 UTC 2016


  Branch: refs/heads/master-2.2
  Home:   https://github.com/dovecot/core
  Commit: 62219bb5a13b95f1fa4c0d90986f2605b6324738
      https://github.com/dovecot/core/commit/62219bb5a13b95f1fa4c0d90986f2605b6324738
  Author: Timo Sirainen <timo.sirainen at dovecot.fi>
  Date:   2016-04-29 (Fri, 29 Apr 2016)

  Changed paths:
    M src/lib-index/mail-index-map.c

  Log Message:
  -----------
  lib-index: Memory allocation optimization


  Commit: 81bbb8ec793a59f724b7c7d242f2187ff50567c2
      https://github.com/dovecot/core/commit/81bbb8ec793a59f724b7c7d242f2187ff50567c2
  Author: Timo Sirainen <timo.sirainen at dovecot.fi>
  Date:   2016-04-29 (Fri, 29 Apr 2016)

  Changed paths:
    M src/lib/mempool-system.c

  Log Message:
  -----------
  lib: Implement i_realloc(mem==NULL) more efficiently

Various parts of code use this to allocate the initial buffer. We can
do this more efficiently by using calloc().


  Commit: 83373a25e7d2c6cc674cebea0db94f510110405f
      https://github.com/dovecot/core/commit/83373a25e7d2c6cc674cebea0db94f510110405f
  Author: Timo Sirainen <timo.sirainen at dovecot.fi>
  Date:   2016-04-29 (Fri, 29 Apr 2016)

  Changed paths:
    M src/lib/buffer.c

  Log Message:
  -----------
  lib: Use p_malloc() explicitly in first buffer_alloc()

Although there is now code in p_realloc() that it should be just as
efficient, this makes profiling somewhat nicer since it can better
distinguish between actual reallocs and initial allocs.


  Commit: 9273e1847d0cf0a2945e3c91c9bccb26869686dd
      https://github.com/dovecot/core/commit/9273e1847d0cf0a2945e3c91c9bccb26869686dd
  Author: Timo Sirainen <timo.sirainen at dovecot.fi>
  Date:   2016-04-29 (Fri, 29 Apr 2016)

  Changed paths:
    M src/lib/buffer.c

  Log Message:
  -----------
  lib: buffer_create_dynamic() now adds +1 to init_size


  Commit: 31a274ee6fd77f9b1814fa18d38b06d6b70c7805
      https://github.com/dovecot/core/commit/31a274ee6fd77f9b1814fa18d38b06d6b70c7805
  Author: Timo Sirainen <timo.sirainen at dovecot.fi>
  Date:   2016-04-29 (Fri, 29 Apr 2016)

  Changed paths:
    M src/lib-index/mail-index-map.c

  Log Message:
  -----------
  lib-index: Use a bit larger initial records buffer size

For example with a mailbox having 160k messages the buffer size is around
10MB. Adding just 1% more space to it allows a lot more appends before the
buffer needs to be realloced. This reduces CPU usage quite a lot.


Compare: https://github.com/dovecot/core/compare/2dc8e2db1251...31a274ee6fd7


More information about the dovecot-cvs mailing list