Speed up BResource loading

The code to parse the resource table reads one entry at a time because
the table size isn't known. This resulted in a lot of read syscalls,
each reading just 12 bytes. Use a BBufferIO to buffer these and reduce
the number of syscalls. This helps especially when there are lot of
resources, for example in libbe with all the country flags.

It also removes some spam from strace output for all these read calls.

Change-Id: Ib165a0eacc2bc5f3d319c22c2fac4f439efbdef2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2858
Reviewed-by: Rene Gollent <[email protected]>
This commit is contained in:
Adrien Destugues
2020-06-01 14:09:54 +00:00
committed by waddlesplash
parent 6178aeb315
commit 1ed08f5856
3 changed files with 21 additions and 18 deletions
+2 -1
View File
@@ -83,7 +83,8 @@ private:
const PEFContainerHeader& pefHeader);
void _ReadHeader(resource_parse_info& parseInfo);
void _ReadIndex(resource_parse_info& parseInfo);
bool _ReadIndexEntry(resource_parse_info& parseInfo,
bool _ReadIndexEntry(BPositionIO& buffer,
resource_parse_info& parseInfo,
int32 index, uint32 tableOffset,
bool peekAhead);
void _ReadInfoTable(resource_parse_info& parseInfo);