diff options
author | Thomas White <taw@physics.org> | 2023-09-23 17:57:20 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2023-09-23 19:37:40 +0200 |
commit | 1a0580e817a0f60505e38c8dd29f9e4eeeae0558 (patch) | |
tree | 4cb92f99fbf100bfab226ea94012da262d4bda77 /src/im-sandbox.c | |
parent | cee7ee0b8a4cafa1f8f3c67518f86c895520f5a6 (diff) |
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.
Diffstat (limited to 'src/im-sandbox.c')
-rw-r--r-- | src/im-sandbox.c | 6 |
1 files changed, 5 insertions, 1 deletions
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 */ |