Re: Finding the applicable methods...

"Tim Bradshaw (as tfb at cley dot com)" <[email protected]> Tue, 14 Jul 2026 21:44:55 +0100
Newsgroups gmane.lisp.lispworks.general
Message-ID <[email protected]>
--Apple-Mail-C7D5307C-2A00-40B5-A5F4-BE7657B7D9D0
Content-Type: text/plain;
	charset=us-ascii
Content-Transfer-Encoding: quoted-printable

On 14 Jul 2026, at 21:11, Robert Goldman (as rpgoldman at sift dot net) <lis=
[email protected]> wrote:
>=20
> Just curious -- does the (:type vector) in the defstruct speed things up? W=
hat's the factor of speedup over using defstruct without that?

This is apocryphal (but I can reproduce evidence I am fairly sure) but struc=
tures defined without the :type option are either as fast as they can be or c=
lose to that, given suitable optimize declarations.  By 'as fast as they can=
 be' I mean 'slot access appears to be as fast as variable access'.

Disclaimer: might be SBCL not LW (but I think it is both), do not taunt happ=
y fun ball.

--tim=

--Apple-Mail-C7D5307C-2A00-40B5-A5F4-BE7657B7D9D0
Content-Type: text/html;
	charset=utf-8
Content-Transfer-Encoding: quoted-printable

<html class=3D"apple-mail-supports-explicit-dark-mode"><head><meta http-equi=
v=3D"content-type" content=3D"text/html; charset=3Dutf-8"></head><body dir=3D=
"auto"><div dir=3D"ltr"></div><div dir=3D"ltr">On 14 Jul 2026, at 21:11, Rob=
ert Goldman (as rpgoldman at sift dot net) &lt;[email protected]&gt; wr=
ote:</div><div dir=3D"ltr"><blockquote type=3D"cite"><br></blockquote></div>=
<blockquote type=3D"cite"><div dir=3D"ltr">Just curious -- does the <code st=
yle=3D"margin: 0 0; padding: 0 0.25em; border-radius: 3px; background-color:=
 #F7F7F7;">(:type vector)</code> in the <code style=3D"margin: 0 0; padding:=
 0 0.25em; border-radius: 3px; background-color: #F7F7F7;">defstruct</code> s=
peed things up?  What's the factor of speedup over using <code style=3D"marg=
in: 0 0; padding: 0 0.25em; border-radius: 3px; background-color: #F7F7F7;">=
defstruct</code> without that?</div></blockquote><br><div>This is apocryphal=
 (but I can reproduce evidence I am fairly sure) but structures defined with=
out the :type option are either as fast as they can be or close to that, giv=
en suitable optimize declarations. &nbsp;By 'as fast as they can be' I mean '=
slot access appears to be as fast as variable access'.</div><div><br></div><=
div>Disclaimer: might be SBCL not LW (but I think it is both), do not taunt h=
appy fun ball.</div><div><br></div><div>--tim</div></body></html>=

--Apple-Mail-C7D5307C-2A00-40B5-A5F4-BE7657B7D9D0--

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
[email protected]
http://www.lispworks.com/support/lisp-hug.html