# Optimizing Processing Speed

When designing your application, keep in mind the following recommendations:

- Use a small number of tools per stream and start building your application with a single tool.

  The processing time for a single tool does not vary significantly based on the amount of information that the tool returns. For example, a single Blue tool that is trained to find 100 different features runs at the same speed as a tool that is trained to find only a single feature A feature is a visually distinguishable area in an image. Features typically represent something of interest for the application (a defect, an object, a particular component of an object).. Furthermore, the number of features returned makes only a minimal speed difference. Similarly, a Red tool runs at the same speed regardless of how many defects it finds, and a Green tool can classify into 2 classes or 200 classes at the same speed.

- Avoid image conversions. Attempt to solve your application using a single-channel grayscale image.

  During operation, the image must be sampled for processing by the neural network. This sampling requires a raster (uncompressed) format image such as a bitmap. Performing this conversion takes time. Similarly, if the tool is configured to use a single-channel (grey-scale) image as input, but the supplied images are multi-channel color images, the luminance value must be computed for each image at run time.

- Reduce the amount of processed data.

  - Use as few image channels as possible.

  - Use a mask.

  - Use a smaller ROI The Region of Interest (ROI) defines the area of operation for the tool. The ROI preserves the positions, angles, stretch and skew of the original image. (best value option).

    Note: VisionPro Deep Learning tools need contextual information to work well, so try not to constrain the ROI too much.

  Downsampling (set through the Sampling Density parameter) is usually not needed. By selecting a larger Feature Size, you can improve speed and remove the need for runtime downsampling.

- Use Multiple GPUs.

  On systems with multiple GPUs, processing multiple streams simultaneously allows tools to execute in parallel, increasing throughput Throughput refers to the total number of images that can be processed per unit of time. If your application can process multiple streams concurrently using different threads, it might be possible to improve system throughput, although individual tool processing is slower..

  On single-GPU systems, you can configure the system to allow multiple processes to use the same GPU. This allows a higher GPU occupancy and can improve throughput, although tool execution time will increase.
  Use the --max-process-count command line argument to enable multiple threads to access a single GPU. To enable multi-process GPU access for a runtime application using the local control's GlobalConfig() method: control.GlobalConfig("max_process_count=2");

- Use C++ (unmanaged).

  Using an unmanaged language environment reduces the impact of system activity on tool execution. For low-latency, high-performance applications, do not use Cognex Designer. Windows is not a real-time operating system (RTOS).