QProgressBar causing bad performance in QT5?

I'm developping a program which parses a file (365000 lines) in which I try to match some keywords after reading each line. This computation along with the update of my QProgressBar are made in another thread using QThread. Everything works fine except for the performance especially when I update the QProgressBar. I use a timer for the parsing and the result is just STUNNING. When I emit a signal to update the QProgressBar the program takes around 45 seconds but when I do not emit the signal for the QProgressBar update then the program takes around 0.40 sec =/

Hi
I dont know python, but if in a c++ application
i would try the same
with no slot connected to see if it was sending the signal
very fast that was the issue.
So try to emit but dont respond to it.
If still fast i would look at the slot.
Using Progressbar in c++, i didn't notice such huge difference and painting
the bar etc should not be so expensive.

I did the test and appearantly it's the painting which is very expensive... with no slot connected, the program takes 1,5 seconds to complete the task. There is a very similar issue reported at https://bugreports.qt.io/browse/QTBUG-49655.

But generally ProgressBars are consuming especially when we update it that often (>365000 times) while there is no significant change at each iteration. So I simply update the QProgressBar less often and the results are good (~1s) and the progression still smooth. PSB :