From 1a0580e817a0f60505e38c8dd29f9e4eeeae0558 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 23 Sep 2023 17:57:20 +0200 Subject: indexamajig: Re-use the image data arrays We noticed that constant freeing and re-allocating the (potentially quite large) arrays resulted in much lower performance. Since we know that all images have the same data layout, we can safely re-use the arrays. This gives a large speedup. --- src/im-sandbox.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/im-sandbox.c') diff --git a/src/im-sandbox.c b/src/im-sandbox.c index 62b46187..1a6c9e88 100644 --- a/src/im-sandbox.c +++ b/src/im-sandbox.c @@ -342,6 +342,7 @@ static int run_work(const struct index_args *iargs, Stream *st, struct im_zmq *zmqstuff = NULL; struct im_asapo *asapostuff = NULL; Mille *mille; + ImageDataArrays *ida; if ( sb->profile ) { profile_init(); @@ -372,6 +373,8 @@ static int run_work(const struct index_args *iargs, Stream *st, mille = crystfel_mille_new(tmp); } + ida = image_data_arrays_new(); + while ( !allDone ) { struct pattern_args pargs; @@ -528,7 +531,7 @@ static int run_work(const struct index_args *iargs, Stream *st, profile_start("process-image"); process_image(iargs, &pargs, st, cookie, tmpdir, ser, sb->shared, sb->shared->last_task[cookie], - asapostuff, mille); + asapostuff, mille, ida); profile_end("process-image"); } @@ -545,6 +548,7 @@ static int run_work(const struct index_args *iargs, Stream *st, free(pargs.event); } + image_data_arrays_free(ida); crystfel_mille_free(mille); /* These are both no-ops if argument is NULL */ -- cgit v1.2.3