J-NPCU - Dynamic image processing with 7x speedup!

Osman Yasal
3 min readJun 19, 2021

--

https://www.britannica.com/story/did-dinosaurs-really-have-feathers

As you may remember i’ve been developing a library called J-NPCU, in order to abstract the details of parallel processing from a developer and making them to write multithreaded applications easily.
In this article i would like to demonstrate to you how to process images faster by this library.

In this example, we’ll be processing list of images just before serving a various numbers of clients. i’m not an expert on image processing so i’ve just made up a random pipeline as below.

image processing pipeline

Time(reading) : 1ms per image
Time(filtering) : 4ms per image
Time(reshaping) : 3ms per image
Time(filtering_2) : takes 3ms per image.
Time(serving) : takes 2ms per image.

let’s assume we’ve 10_000 images to process, on single processor(core) this pipeline takes 1_000 * 15=15_000ms = 15 second theoretically minimum(best) score for serial processing.

note that: we’ll be processing on 480X540 images(259KB), to see the actual size please visit : https://elmosaukko.com/banner/q/480x540

Lets see how we make this better by using J-NPCU.

Here’s a quick recap of creating a node in the library

in this template all we have to do is to define the job that’ll be executed into the operate() method and the library takes the rest of all.
We’ll be executing 5 times in order to estimate average performance, here’s our main method.

Here’s our implementation

Reader Node

This node is responsible to reading images from storage to the Ram and transmits to filter actor. We only create new Image objects for simplicity but you might enhance that node for reading images from a file with BUFFER in order to increase performance.

FilterX

This is a filter class that does some filtering operations on that image is came from reader node.

Reshape Node

This is a node for reshaping the image.

FilterY

This is a filter class that does some filtering operations on that image is came from reader node.

Serve Node

This node is for distribution images, transmits processed images to arbitrary number of consumers

Execution Results

Woow!! That’s AMAZINGG we do the same opreations with J-NPCU approximately 7.3x faster!

Concluding my word i would like to emphasize this : with J-NPCU the programmer doesn’t need to know the details of the parallel processing. They just need to focus the job they want to perform.

Thanks for the reading ❤

--

--

Osman Yasal
Osman Yasal

Written by Osman Yasal

Parallel Computing | Performance tools | Digital Twins | Computer Vision | Image Processing | Deep Learning.

No responses yet