Optimization to reduce almost to zero allocations during frame rendering in ecode (this gives around 6% perf gains).

This commit is contained in:
Martín Lucas Golini
2024-10-29 02:11:33 -03:00
parent cac43d0276
commit 0e0ce71609
15 changed files with 337 additions and 203 deletions

View File

@@ -258,8 +258,11 @@ void GitPlugin::initModelStyler() {
auto model = static_cast<const FileSystemModel*>( index.model() );
auto node = static_cast<const FileSystemModel::Node*>( data );
Lock l( mGitStatusFileCacheMutex );
auto found =
mGitStatusFilesCache.find( std::string{ model->getNodeRelativePath( node ) } );
std::string_view nodePath = model->getNodeRelativePath( node );
auto found = std::find_if( mGitStatusFilesCache.begin(), mGitStatusFilesCache.end(),
[&nodePath]( const std::string& key ) {
return std::string_view{ key } == nodePath;
} );
if ( found != mGitStatusFilesCache.end() )
return Variant( STYLE_MODIFIED );
return Variant( STYLE_NONE );