-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RUM-3796: Optimise BatchFileOrchestator
performance
#1968
RUM-3796: Optimise BatchFileOrchestator
performance
#1968
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice job there !
get() = File("${this.path}_metadata") | ||
private fun listSortedBatchFiles(): List<File> { | ||
// note: since it is using File#compareTo, lexicographical sorting will be used, meaning "10" comes before "9". | ||
// but for our needs it is fine, because the moment when Unix timestamp adds one more digit will be in 2286. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few, I guess it'll be for others to deal with this then…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless SDK is installed on time machine device
916d402
to
949f2c9
Compare
949f2c9
to
63471a2
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## develop #1968 +/- ##
===========================================
- Coverage 83.40% 83.38% -0.01%
===========================================
Files 489 489
Lines 17923 17902 -21
Branches 2669 2669
===========================================
- Hits 14947 14927 -20
- Misses 2237 2241 +4
+ Partials 739 734 -5
|
What does this PR do?
This PR optimise
BatchFileOrchestator
performance by doing the following changes:File.isFile
check - this is expensive syscall and it should be only files in the particular folder anyway (it is onlyBatchFileOrchestrator
who works with that folder) and we check file names anyway. AlsoFile.isFile
doc says:Any non-directory file created by a Java application is guaranteed to be a normal file.
Long
.File.isFile
check is removed as benchmarks show below)Benchmarks
The testing approach was the following: generate 500 files of size ranging from 1Kb to 32Kb, evenly distributed in the last 24h by their names as timestamps. Then do 100 calls to
getWritableFile
passingforceNewFile = true
at every even call, andforceNewFile = false
at every odd call.Tests:
getWritableFile
)Table below shows the average duration of each
getWritableFile
call in milliseconds.File.isFile
removedNB: it shouldn't be considered as a proper benchmarking methodology (JMH is not compatible with AGP, there is some variability, etc.), but can give an idea of the impact for the improvements.
Last 2 changes (cache removal and change of the cleanup frequency) are not listed, because they directly impact tests.
All changes are in separate commits.
Review checklist (to be filled by reviewers)