Skip to content

Commit

Permalink
Make default degree for hyper/batch make more sense
Browse files Browse the repository at this point in the history
Currently, the default :degree for .hyper / .race is set to 4.  This
may be too high for small single core CPU's, and to small for bigger
beasts (such as my MBP with 2x8 cores).  Set the default to the number
of CPU cores available, and introduce the $*DEGREE dynamic variable
for setting the default for a given scope.
  • Loading branch information
lizmat committed Jan 14, 2020
1 parent a81b28a commit 9fd29cd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core.c/Iterable.pm6
Expand Up @@ -28,7 +28,7 @@ my role Iterable {
Seq.new(Rakudo::Iterator.Lazy(self))
}

method hyper(Int(Cool) :$batch = 64, Int(Cool) :$degree = 4) {
method hyper(Int(Cool) :$batch = 64, Int(Cool) :$degree = $*DEGREE // nqp::cpucores) {
#?if !js
HyperSeq.new:
configuration =>
Expand All @@ -41,7 +41,7 @@ my role Iterable {
#?endif
}

method race(Int(Cool) :$batch = 64, Int(Cool) :$degree = 4) {
method race(Int(Cool) :$batch = 64, Int(Cool) :$degree = $*DEGREE // nqp::cpucores) {
#?if !js
RaceSeq.new:
configuration =>
Expand Down

0 comments on commit 9fd29cd

Please sign in to comment.