Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 425ec7a9 authored by Junyu Lai's avatar Junyu Lai
Browse files

Read files in increasing timestamp order in FileRotator

The current design of the readMatching() function reads all
files that match a given prefix, but does not guarantee
the order in which they are read. This could cause
performance problems because the caller is optimized for
inserting files in ascending timestamp order but the files
are read in a reversed order.

This change sorts the list by the timestamp in the file name,
which is more natural since the files are written based on
timestamp. Benchmarking result shows that
testReadFromRecorder_manyUids improved from 1.5s to 1.0s
compares to the worst case.

Also, this is safe because all callers of the
readMatching() function only pass a list of less than 20 files.
None of these callers rely on the order in which the
files are read.

Test: atest ConnectivityBenchmarkTests FileRotatorTest
Bug: 269409485
Change-Id: I73f10890e8f454ee98e7d92fa754d1affe598df4
parent 5c4b8708
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment