Bug 468259

Summary: High CPU usage during intensive scrolling
Product: [Applications] konsole Reporter: Yaroslav <yaroslav.rastrigin>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: REPORTED ---    
Severity: major    
Priority: NOR    
Version: 22.12.3   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description Yaroslav 2023-04-07 20:39:13 UTC
SUMMARY
***
scrolling a lot of text incurs large performance overhead. konsole is consuming up to 65% of a single core if I'm doing, f.e. , `tail` -f of a quickly updating log file
***


STEPS TO REPRODUCE
1. induce scrolling . easiest way is to run 'while [ 1 ] ; do echo 'testtesttesttesttest' ; done 
2. open `top` or run another performance monitor 

OBSERVED RESULT
high cpu usage, over 50% of a single core

EXPECTED RESULT
negligible cpu usage, as with other terminal emulation software

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version: kde-frameworks/plasma-5.104.0:5/5.104
KDE Frameworks Version: 5.104
Qt Version: 5.15.8

ADDITIONAL INFORMATION
I have tested this with both Gentoo packages built from source by myself  , and precompiled Arch linux packages. 
During investigation I've compiled konsole and QtGui with debugging symbols, and ran `perf record` + `perf report` dwhile reproducing the issue. The culprit seems to be incorrect or excessive usage of alphargbblend_argb32
     37.13%     0.00%  konsole         libQt5Gui.so.5.15.8             [.] QtSharedPointer::ExternalRefCountWithCustomDeleter<QColorTrcLut, QtSharedPointer::NormalDeleter>::deleter
            |
            ---QtSharedPointer::ExternalRefCountWithCustomDeleter<QColorTrcLut, QtSharedPointer::NormalDeleter>::deleter
               0x5645ea71a9c0
               |          
               |--31.87%--alphargbblend_argb32
               |          
                --5.26%--qt_alphargbblit_argb32
Comment 1 Yaroslav 2023-04-07 20:46:48 UTC
I can repro the same issue with qterminal , but with smaller performance hit (CPU usage hovers in 20% to 50%, which is still too much compared with VTE-based terminals). Highest CPU consumer is the same (alphargbblend_argb32 )