Skip to content

Performance regression: cv::medianBlur on Windows ~3× slower in OpenCV 4.12 vs 4.11 #98

Description

@lstahlman

Mirrored from upstream: opencv#28253
Original author: @soemay · created 2025-12-19T18:52:24Z
Upstream labels: bug, optimization, category: imgproc
Selection: mirrored by mirror-issues.py


System Information

Tested with OpenCV 4.11, 4.12 (official windows packages)
Windows 11 (64-Bit)
Compiler: MSVC Version 19.44.35222 (Visual Studio 2022)
Tested CPUs: Intel Xeon W-3335, AMD Ryzen 5 3600 (no AVX512, does not show regression)

Detailed description

Observed Timing:
Intel Xeon W-3335
OpenCV 4.11: ~32 ms average
OpenCV 4.12: ~94 ms average

AMD Ryzen 5 3600
OpenCV 4.11: ~32 ms average
OpenCV 4.12: ~30 ms average (reason no AVX512?)

I assume the last changes from opencv#27299 caused this behaviour.
Because if i revert these changes and compile OpenCV 4.12 myself I get the same performance as in OpenCV 4.11.

Steps to reproduce

#include <opencv2/opencv.hpp>
#include <iostream>
#include <opencv2/imgproc.hpp>
int main()
{
  cv::Mat randomMat(5000, 5000, CV_8UC1);
  cv::randu(randomMat, 0, 256);
  const int runs = 100;

  cv::TickMeter tm;
  tm.start();
  for (int i = 0; i < runs; ++i)
  {
    cv::medianBlur(randomMat, randomMat, 5);
  }
  tm.stop();

  std::cout << "Elapsed time avg: " << tm.getTimeMilli() / runs << " ms" << std::endl;
  return 0;
}

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions