Optimization of EQUAL with type that excludes special cases
Bug #1848583 reported by
Paul F. Dietz
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Enhancement for the wishlist:
(declaim (optimize speed (safety 0) (compilation-speed 0) (space 0) (debug 0)))
(defun f (x y) (declare (type (not (or array cons number character pathname)) x)) (equal x y))
(disassemble 'f) ==>
; disassembly for F
; Size: 15 bytes. Origin: #x52CF99D6 ; F
; D6: B904000000 MOV ECX, 4
; DB: FF7508 PUSH QWORD PTR [RBP+8]
; DE: B802BA4350 MOV EAX, #x5043BA02 ; #<FDEFN EQUAL>
; E3: FFE0 JMP RAX
With that type declaration, EQUAL is equivalent to EQ, but that optimization has not been performed.
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
(equal "abc" x) is not optimized to string=, although it could be.
In general, these sorts of compile-time dispatch optimizations would be rigorously tested by the existing RTP tests in ansi-tests.