# 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. 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 (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.

  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).