Skip to content

Commit

Permalink
Streamline ThreadPoolScheduler!total-workers
Browse files Browse the repository at this point in the history
- make sure we don't box/unbox unneccesarily
- add "is raw" so that we don't box/unbox on return
  - this appears to make the return from sub about 20% faster
  - when assigning to a native
  • Loading branch information
lizmat committed Oct 27, 2017
1 parent b849622 commit e513f19
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/core/ThreadPoolScheduler.pm
Expand Up @@ -632,8 +632,14 @@ my class ThreadPoolScheduler does Scheduler {
}
}

method !total-workers() {
$!general-workers.elems + $!timer-workers.elems + $!affinity-workers.elems
method !total-workers() is raw {
nqp::add_i(
nqp::elems($!general-workers),
nqp::add_i(
nqp::elems($!timer-workers),
nqp::elems($!affinity-workers)
)
)
}

submethod BUILD(
Expand Down

0 comments on commit e513f19

Please sign in to comment.