Skip to content

Commit

Permalink
minor perf increase when finding excel pages
Browse files Browse the repository at this point in the history
  • Loading branch information
NotAdam committed Oct 10, 2023
1 parent 4255ff2 commit 1b61d35
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Lumina/Excel/ExcelSheetImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,16 @@ internal void GenerateFilePages()
/// <returns>The <see cref="ExcelPage"/> if found, null otherwise</returns>
public ExcelPage? GetPageForRow( uint row )
{
var data = DataPages.FirstOrDefault( s => s.RowData.ContainsKey( row ) );
// var data = DataPages.FirstOrDefault( s => s.RowData.ContainsKey( row ) );

var page = DataPages.FirstOrDefault( s => row >= s.StartId && row <= s.StartId + s.RowCount );

// if( data == null )
// {
// throw new KeyNotFoundException( $"row {row} not found in sheet {Name}!" );
// }

return data;
return page;
}

protected static ulong GetCacheKey( uint rowId, uint subrowId = UInt32.MaxValue )
Expand Down

0 comments on commit 1b61d35

Please sign in to comment.