xaizek / etabench (License: GPLv3) (since 2022-09-08)
Benchmark for algorithms that compute I/O ETA
Commit 96f7062694a44926b9b0a2d77f09f29224010c6d

Fix Firefox algorithm
Uninitialized variable made it seem significantly better than it's
actually is...
Author: xaizek
Author date (UTC): 2022-12-30 18:24
Committer name: xaizek
Committer date (UTC): 2022-12-30 18:24
Parent(s): 0f2a4fa0f0abd6186a1d1b4b7398c2a31db4c972
Signing key: 99DC5E4DB05F6BE2
Tree: c79b50dc5c3c0c9a4f59ab46a3a89c8ef585821f
File Lines added Lines deleted
src/algs.cpp 6 2
File src/algs.cpp changed (mode: 100644) (index 5b54826..4f218e8)
... ... FirefoxAlg::reset()
376 376 lastEta = 0; lastEta = 0;
377 377 lastProgress = 0; lastProgress = 0;
378 378 lastTime = 0; lastTime = 0;
379 speed = 0;
379 380 } }
380 381
381 382 int int
382 383 FirefoxAlg::estimate(int current, int total, int time) FirefoxAlg::estimate(int current, int total, int time)
383 384 { {
384 385 float v = float(current - lastProgress)/(time - lastTime); float v = float(current - lastProgress)/(time - lastTime);
385 speed = v*0.1f + speed*0.9f;
386 if (lastTime == 0)
387 speed = v;
388 else
389 speed = v*0.1f + speed*0.9f;
386 390
387 391 float eta = (total - current)/speed; float eta = (total - current)/speed;
388 392
389 393 // Apply hysteresis to favor downward over upward swings 30% of down and 10% // Apply hysteresis to favor downward over upward swings 30% of down and 10%
390 394 // of up (exponential smoothing). // of up (exponential smoothing).
391 395 float etaDiff = eta - lastEta; float etaDiff = eta - lastEta;
392 eta = lastEta + (etaDiff < 0 ? 0.3 : (lastTime == 0 ? 0.4 : 0.1))*etaDiff;
396 eta = lastEta + (lastTime == 0 ? 1.0f : etaDiff < 0 ? 0.3f : 0.1f)*etaDiff;
393 397
394 398 // If the new ETA is similar, reuse something close to the last ETA, but // If the new ETA is similar, reuse something close to the last ETA, but
395 399 // subtract a little to provide forward progress. // subtract a little to provide forward progress.
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/etabench

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/etabench

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master