Skip to content

Commit

Permalink
Update output for fair benchmark comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
SammyK committed May 17, 2020
1 parent 682bbe0 commit f336ccd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
17 changes: 15 additions & 2 deletions cereal.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "php_cereal.h"
#include "cereal_arginfo.h"

#define CEREAL_ARENA_SIZE 1024 // TODO Figure out how much we need
#define CEREAL_ARENA_SIZE 1024 * 32 // TODO Figure out how much we need

ZEND_DECLARE_MODULE_GLOBALS(cereal)

Expand Down Expand Up @@ -109,16 +109,29 @@ static PHP_RINIT_FUNCTION(cereal)
static PHP_RSHUTDOWN_FUNCTION(cereal)
{
if (CEREAL_G(use_arena) == 1) {
#if 0
ptrdiff_t bytes = 0;
zend_arena *a = cereal_arena;
while (a) {
bytes += ((char *) a->end) - ((char *) a->ptr);
a = a->prev;
}
php_printf("Arena size: %td bytes\n", bytes);
#endif
php_printf("Freeing arena (%p)\n", cereal_arena);
zend_arena_destroy(cereal_arena);
cereal_arena = NULL;
} else {
cereal_obj *c = cereals;
cereal_obj *tmp;

if (c) {
php_printf("Freeing cereals one at a time (%p)\n", c);
}

while (c) {
tmp = c->prev;
php_printf("Freeing cereal #%lu (%p)\n", (unsigned long) c->obj->handle, c);
//php_printf("Freeing cereal #%lu (%p)\n", (unsigned long) c->obj->handle, c);
GC_DELREF(c->obj);
zend_object_std_dtor(c->obj);
efree(c);
Expand Down
11 changes: 1 addition & 10 deletions tests/001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,4 @@ Made internal cereal #7
Made internal cereal #8
Made internal cereal #9
Made internal cereal #10
Freeing cereal #10 (%s)
Freeing cereal #9 (%s)
Freeing cereal #8 (%s)
Freeing cereal #7 (%s)
Freeing cereal #6 (%s)
Freeing cereal #5 (%s)
Freeing cereal #4 (%s)
Freeing cereal #3 (%s)
Freeing cereal #2 (%s)
Freeing cereal #1 (%s)
Freeing cereals one at a time (%s)

0 comments on commit f336ccd

Please sign in to comment.