<div dir='auto'>is sbcl doing more type inference here?</div><div class="gmail_extra"><br><div class="gmail_quote">On Oct 21, 2022 6:53 PM, Garrett Dangerfield <garrett@dangerimp.com> wrote:<br type="attribution" /><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Good call. Got the time down with SBCL to 3.5 seconds. So still more than twice Java. ABCL with the same code with the big file (5.8G) is around 110+ seconds.</div><div><br /></div><div>I'm still surprised by ABCL being SO much slower than SBCL especially with Java being faster than SBCL.</div><div><br /></div><div>Thoughts?</div><div><br /></div><div>Thanks,</div><div>Garrett.<br /></div><div><br /></div><div>P.S. I also took the "time" out, I am doing SBCL/ABCL the same way as I did in Java with the getting the start time before reading and getting the time after reading. and calculating the duration that way. It didn't make any difference that I could see in the times.</div><div><br /></div><div>Lisp code:</div><div> (with-open-file (stream "/media/danger/OS/temp/great_expectations.iso"<br /> :element-type '(unsigned-byte 8)<br /> :external-format 'iso-8859-1) ; jars.txt iso-8859-1 also tried :default and the time was the same<br /> (let ((size (file-length stream))<br /> (buffer-size (* 16 1024 1024)) ; 16M<br /> (start (get-internal-real-time))<br /> )<br /> (loop with buffer = (make-array buffer-size :element-type '(unsigned-byte 8))<br /> for n-characters = (read-sequence buffer stream)<br /> while (< 0 n-characters))<br /> (format t "took ~,2f secs" (/ (- (get-internal-real-time) start)<br /> internal-time-units-per-second))<br /> ))<br /></div></div><br /><div class="elided-text"><div dir="ltr">On Fri, Oct 21, 2022 at 2:52 PM Pascal Bourguignon <<a href="mailto:pjb@informatimago.com">pjb@informatimago.com</a>> wrote:<br /></div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb( 204 , 204 , 204 );padding-left:1ex">Le 21/10/2022 à 23:18, Garrett Dangerfield a écrit :<br />
> I tried changing (make-array buffer-size :element-type 'character)<br />
> to<br />
> (make-array buffer-size :element-type 'byte)<br />
> and I got additional warnings and it took 70 seconds instead of 20.<br />
> <br />
<br />
You need to specify a binary file too!<br />
<br />
(deftype octet () '(unsigned-byte 8))<br />
(with-open-file (stream #P"~/Downloads/Discord.dmg"<br />
:element-type 'octet<br />
:external-format :default)<br />
(print `(size = ,(file-length stream)))<br />
(let ((buffer-size (* 16 1024 1024)))<br />
(time<br />
(loop with buffer = (make-array buffer-size :element-type 'octet)<br />
for n-bytes = (read-sequence buffer stream)<br />
while (plusp n-bytes)))))<br />
<br />
<br />
<br />
-- <br />
__Pascal Bourguignon__<br />
<br />
<br />
</blockquote></div>
</blockquote></div><br></div>