Performance improvements to this code...
Hi. We've done a fair bit of profiling to our system and have eliminated all known major hotspots. We're now looking at other possibilities, and this section of code might be a candidate: (defmethod stream:stream-read-byte ((strm binary-input-stream)) (declare (optimize speed)) (with-slots ((buf buffer) (i index) (size bufsiz)) strm (declare (type fixnum i size) (type (array (unsigned-byte 8)) buf)) (if (= i size) :eof (aref buf (the fixnum (1- (the fixnum (incf i)))))))) This code reflects the optimizations we've done that addressed a hotspot identified by the profiler. I'm wondering if there's anything more to be done here. In our test suite, this method is called more than any other in the system (over 7million times), although it's found on the stack top just 2% of the time. I've looked at using svref instead of aref, but doing so causes a runtime failure: Error: In a call to SVREF: #(76 105 115 80 14 10 5 1 6 78 84 85 80 76 69 5 1 6 84 85 80 76 69 83 24 0 1 2 10 5 1 3 75 69 89 1 1 3 5 1 ...) is not of type SIMPLE-VECTOR. 1 (abort) Return to level 0. 2 Return to top loop level 0. Type :b for backtrace, :c <option number> to proceed, or :? for other options DT 5 : 1 > The array is of type '(unsigned-byte 8)). Recommendations are appreciated. David E. Young Bloodhound Software, Inc. For wisdom is more precious than rubies, and nothing you desire can compare with her. -- Prov. 8:11 "But all the world understands my language." -- Franz Josef Haydn (1732 - 1809) This email message is for the sole use of the intended recipients(s) and may contain confidential and privileged information of Bloodhound Software, Inc.. Any unauthorized review, use, disclosure is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.