random: encourage inlining.
Reduces overhead to 6% over #%kernel's for the integer case.
This commit is contained in:
parent
740b6dc198
commit
47f06f11e1
|
@ -17,6 +17,7 @@
|
|||
"member.rkt"
|
||||
"kernstruct.rkt"
|
||||
"norm-arity.rkt"
|
||||
"performance-hint.rkt"
|
||||
"top-int.rkt"
|
||||
'#%builtin ; so it's attached
|
||||
(for-syntax "kw.rkt"
|
||||
|
@ -109,6 +110,7 @@
|
|||
'random
|
||||
(string-append "integer greater than " (number->string x))
|
||||
y))))
|
||||
(begin-encourage-inline
|
||||
(define-values (-random) ; more featureful than #%kernel's `random`
|
||||
(case-lambda
|
||||
[() (random)] ; no args, random float
|
||||
|
@ -137,7 +139,7 @@
|
|||
(enforce-greater min max)
|
||||
(unless (pseudo-random-generator? prng)
|
||||
(raise-argument-error 'random "pseudo-random-generator?" prng))
|
||||
(+ min (random (- max min) prng))]))
|
||||
(+ min (random (- max min) prng))])))
|
||||
|
||||
(define-values (new:collection-path)
|
||||
(let ([collection-path (new-lambda (collection
|
||||
|
|
Loading…
Reference in New Issue
Block a user