make-array with non-constant :element-type '(unsigned-byte 8) is too slow
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Low
|
Unassigned |
Bug Description
Using 1.057 on Linux/x86_64, with *features*:
:SB-BSD-
(defun mkar/nonconst (size external-format)
(declare (optimize (speed 3) (safety 0) (debug 1))
(type (unsigned-byte 16) size))
(make-array size :element-type (if external-format
NIL
OS> (time (dotimes (i 10000000) (mkar/nonconst 5 nil)))
Evaluation took:
24.890 seconds of real time
24.933558 seconds of total run time (24.933558 user, 0.000000 system)
[ Run times consist of 1.004 seconds GC time, and 23.930 seconds non-GC time. ]
100.18% CPU
39,723,365,896 processor cycles
5,280,018,416 bytes consed
NIL
OS> (time (dotimes (i 10000000) (mkar/nonconst 5 t)))
Evaluation took:
1.151 seconds of real time
1.156073 seconds of total run time (1.156073 user, 0.000000 system)
[ Run times consist of 0.164 seconds GC time, and 0.993 seconds non-GC time. ]
100.43% CPU
1,836,654,675 processor cycles
800,007,280 bytes consed
NIL
tags: | added: easy optimization |
summary: |
- make-array with non-constant :element-type '(unsigned-byte 8) conses a - lot + make-array with non-constant :element-type '(unsigned-byte 8) is too + slow |
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
sb!impl: :%vector- widetag- and-n-bits and %complex- vector- widetag punt to SUBTYPEP when adding a set of EQUAL tests would catch nearly all cases. The use of CASE instead of lookup tables for the fast (non-subtypep) paths is also questionable, but any difference is probably marginal.