Skip to content

Commit

Permalink
Nano-optimize supervisor thread sleep
Browse files Browse the repository at this point in the history
By avoiding .Bridge->.Num calls on SUPERVISION_INTERVAL
every 100th of a second. Pointless speed-wise, given we're sleeping
anyway, but it was polluting my Rat usage measurements data
by spamming .Bridge, .Num calls into the log.
  • Loading branch information
zoffixznet committed Mar 2, 2018
1 parent 79a95b4 commit 4617976
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/Date.pm
Expand Up @@ -223,7 +223,7 @@ multi sub sleep($seconds --> Nil) {
take $seconds - 1e9 * ($seconds / 1e9).Int;
}
}
elsif $seconds > 0 {
elsif $seconds > 0e0 {
nqp::sleep($seconds.Num);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/ThreadPoolScheduler.pm
Expand Up @@ -452,7 +452,7 @@ my class ThreadPoolScheduler does Scheduler {
# The supervisor sits in a loop, mostly sleeping. Each time it wakes up,
# it takes stock of the current situation and decides whether or not to
# add threads.
my constant SUPERVISION_INTERVAL = 0.01;
my constant SUPERVISION_INTERVAL = 1e-2;
my constant NUM_SAMPLES = 5;
my constant EXHAUSTED_RETRY_AFTER = 100;
method !maybe-start-supervisor(--> Nil) {
Expand Down

0 comments on commit 4617976

Please sign in to comment.