-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Instead of each process reducing a counter and yielding when the counter reaches zero, each process now tracks an epoch. This epoch is a global counter incremented every 10 milliseconds by a background thread. The compiler in turn inserts a "preempt" instruction, compiled to code that checks the process' epoch against the global epoch. If the two differ, the process yields control back to the scheduler. This new approach can improve performance by up to 40%, in part because we no longer need function calls and instead compile the instruction directly to machine code. In addition, we no longer insert the preemption check after every method call, instead only inserting it at the end of a loop iteration, or before a next or break. This new setup is less fine-grained compared to the old approach, but that's OK as the end goal is not to give each process the exact same amount of fuel/time, but rather to prevent one process from forever holding on to a scheduler thread. This fixes #522. Changelog: performance
- Loading branch information
1 parent
1a30de9
commit cc8c6fe
Showing
19 changed files
with
593 additions
and
445 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.