1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-14 10:13:05 +02:00
pgbackrest/libc
David Steele 5afd950ed9 Improve performance of MEM_CONTEXT*() macros.
The prior code used TRY...CATCH blocks to cleanup mem contexts when an error occurred. This included freeing new mem contexts that were still being initialized when the error occurred and ensuring that the prior memory context was restored.

This worked fine in production but it involved a lot of setjmp()/longjmp() calls that resulted in longer compilation times and sluggish performance under valgrind, profiling, and coverage testing.

Instead maintain a stack of new contexts and context switches that can be used to do cleanup after an error. Normally, the stack is not used for this purpose and pushing/popping is a cheap operation. In the prior implementation most of the TRY...CATCH logic needed to be run even on success.

One bonus is that the binary is about 8% smaller after this change.  Another benefit is that new contexts *must* be explicitly freed/discarded or an error will occur.  See info/manifest.c for an example of where this is useful outside the standard macros.
2020-02-26 21:15:39 -05:00
..
build/lib/pgBackRestLibC Remove unused LibC code. 2019-12-28 18:30:32 -07:00
xs Add MEM_CONTEXT_PRIOR() block and update current call sites. 2020-01-17 13:29:49 -07:00
LibC.h Improve performance of MEM_CONTEXT*() macros. 2020-02-26 21:15:39 -05:00
LibC.xs Remove unused LibC code. 2019-12-28 18:30:32 -07:00
Makefile.PL Use pkg-config instead of xml2-config for libxml2 build options. 2020-01-24 10:08:05 -07:00
typemap Add Perl interface to C PgQuery object. 2019-07-25 17:05:39 -04:00