Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion io/io/src/TBufferFile.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,10 @@ Int_t TBufferFile::ReadArray(Int_t *&ii)

if (ShouldNotReadCollection(l, n)) return 0;

if (!ii) ii = new Int_t[n];
// Allocate a buffer for this array if the caller hasn't done so.
// Note: Offset arrays require one more element than n claims, so we need to overallocate.
if (!ii)
ii = new Int_t[n + 1];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems to be a fixed need to one particular case of the use of ReadArray that is costing (a bit) every other use of ReadArray (apriori there are many distinct ones). I/we would have to look at the particular case (offset array) and see if there isn't any better (aka better localized) solution.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alternative to allocating inside ReadArray(Int_t*) is to perform the allocation outside, and pass the already-allocated buffer into ReadArray.
This would amount to (partly) backtracking on fe1be25


#ifdef R__BYTESWAP
# ifdef USE_BSWAPCPY
Expand Down
Loading