Commit de0cc62
Greg Barnett
bugfix and simplification in TimeService
The main bug was that ceil was called on time returned by loop.time()
before being used to schedule the next iteration of the callback that
updated the TimeService. The TimeService was then incrementing its
stored time by one second. This resulted in the time being updated by
one second about every 1.5 seconds, quickly causing it to fall behind.
There was code to reset TimeService's internal time every 10 minutes,
but that has been removed. Benchmarking has shown that just calling
time.time() has no statistically valid performance difference than the
code that checked for the need to reset. Even if it were slightly
slower, it is only called once per second. Also, the counter that was
used to compare to the reset limit was never incremented, so the reset
never actually ever happened.
I was tempted to remove the properties for accessing time and loop time,
as time.time() and loop.time() are not expensive calls. But I didn't
want to break the API for anyone using this. The only significant
performance gain I was able to find was with strtime. My use case
doesn't push aiohttp very hard, so I can't replicate whatever
performance issue TimeService was intended to solve.1 parent ee69c40 commit de0cc62
2 files changed
+27
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
576 | 576 | | |
577 | 577 | | |
578 | 578 | | |
| 579 | + | |
579 | 580 | | |
580 | | - | |
581 | | - | |
582 | 581 | | |
583 | | - | |
| 582 | + | |
| 583 | + | |
584 | 584 | | |
585 | 585 | | |
586 | 586 | | |
| |||
589 | 589 | | |
590 | 590 | | |
591 | 591 | | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | | - | |
598 | | - | |
599 | | - | |
| 592 | + | |
| 593 | + | |
600 | 594 | | |
601 | | - | |
602 | | - | |
603 | | - | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
604 | 598 | | |
605 | 599 | | |
606 | 600 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
414 | | - | |
| 414 | + | |
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
418 | | - | |
419 | 418 | | |
420 | 419 | | |
421 | 420 | | |
422 | | - | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
423 | 439 | | |
424 | 440 | | |
425 | 441 | | |
| |||
0 commit comments