Search in cache before issuing syscall.

This commit is contained in:
Bartosz Taudul 2021-01-26 01:47:00 +01:00
parent 4a957ea41f
commit 81c91a87fc

View File

@ -7388,10 +7388,10 @@ void Worker::CacheSource( const StringRef& str )
assert( m_checkedFileStrings.find( str ) == m_checkedFileStrings.end() ); assert( m_checkedFileStrings.find( str ) == m_checkedFileStrings.end() );
m_checkedFileStrings.emplace( str ); m_checkedFileStrings.emplace( str );
auto file = GetString( str ); auto file = GetString( str );
if( SourceFileValid( file, GetCaptureTime() ) ) // Possible duplication of pointer and index strings
if( m_data.sourceFileCache.find( file ) == m_data.sourceFileCache.end() )
{ {
// Possible duplication of pointer and index strings if( SourceFileValid( file, GetCaptureTime() ) )
if( m_data.sourceFileCache.find( file ) == m_data.sourceFileCache.end() )
{ {
FILE* f = fopen( file, "rb" ); FILE* f = fopen( file, "rb" );
fseek( f, 0, SEEK_END ); fseek( f, 0, SEEK_END );