Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > alt.folklore.computers > #235466
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Kragen Javier Sitaker <kragen@canonical.org> |
| Newsgroups | comp.lang.lisp, alt.folklore.computers, alt.sys.pdp10 |
| Subject | boxing all integers (was Re: Resources to learn common lisp?) |
| Date | Sat, 29 Aug 2026 17:52:49 -0300 |
| Organization | Primarily biological and memetic |
| Lines | 51 |
| Message-ID | <87mru47iou.fsf_-_@debian> (permalink) |
| References | <874inbqdz7.fsf@mariorosell.es> <jwv5x3rg80j.fsf-monnier+comp.lang.lisp@gnu.org> <110a9pp$ckmk$6@dont-email.me> <110es1g$1kk17$1@dont-email.me> <110fj4q$1r13s$5@dont-email.me> <110guci$26cjr$1@dont-email.me> <110i789$2iqm8$7@dont-email.me> <110j4qk$2q1p4$1@dont-email.me> <110l0v9$3av52$1@dont-email.me> <jwvbjdd5gx3.fsf-monnier+comp.lang.lisp@gnu.org> <110nf0q$3vra6$3@dont-email.me> <87y0gg62cx.fsf@nightsong.com> <110rfqf$142ot$1@dont-email.me> <111ne5o$vsm3$3@dont-email.me> <111pbk6$36pi7$1@dont-email.me> <87qzlqgiyx.fsf@gmail.com> <111t96n$6sqq$1@dont-email.me> <list-20260629095538@ram.dialup.fu-berlin.de> <111tev9$8hea$1@dont-email.me> <875x2zzres.fsf@nightsong.com> <86se5zr6ez.fsf@williamsburg.bawden.org> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| Injection-Date | Sat, 29 Aug 2026 20:55:10 +0000 (UTC) |
| Injection-Info | dont-email.me; logging-data="3745584"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/8u/4Lymu+OxcZ9MNcYsnK"; posting-host="19c753fba95970cf1a99e4804f17687c" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
| Cancel-Lock | sha1:LQ1OJxdB4txMugGTF24xRXe2r0Y= sha1:i+5ytVl0iBfo0ZaJ2zpO7JDQtZk= sha256:pEHo8+A9GjXplBj9bCziicrcqPAULOs9MCZwiDwaitA= sha1:Ey+RqUqwYp6q361sZglBGpLB+W4= sha256:T9sNTMisGZPzLkZZdQRWrGT4yNrrverVmJP62cArN8Y= |
| Xref | csiph.com comp.lang.lisp:61617 alt.folklore.computers:235466 alt.sys.pdp10:9969 |
Cross-posted to 3 groups.
Show key headers only | View raw
Alan Bawden <alan@csail.mit.edu> writes: > Paul Rubin <no.email@nospam.invalid> writes: >> All CPython integers are boxed, but small ones (-5 through +250 or >> something like that) are pre-allocated. Sounds awful but I think some >> Lisps also have done that. > > For example, PDP-10 MacLisp. The PDP-10 is a word addressed machine, > where addresses are 18 bits, and words are 36 bits. PDP-10 integers are > 36 bits long, so pretty much your only choice for representing fixnums > is as an 18-bit pointer to a 36-bit signed integer, i.e. "boxed". I had no idea! Never having used it, I had always assumed that MACLISP shared the behavior of things like SBCL, Smalltalk, and recent versions of Python — transparently overflowing from fixnums to bignums. One advantage of the transparent-overflow approach is that most of the time users don’t care what the actual fixnum limit is — it’s “just” a performance optimization, in that your arithmetic starts consing when you exceed the limit. This does mean, however, that by default, for example on SBCL, all of your arithmetic is stuffed full of overflow checks, which has performance costs of its own. > • If an intermediate fixnum needs to be allocated, say to pass as an > argument to another function, it can be allocated in a special area > of memory that has fixnum type, but that is managed as a stack -- the > GC doesn't touch it. That temporary number is then popped out of > existence after the function call returns. This does mean that the > compiler has to constantly worry that an object that it is about to > store someplace permanent might be a stack allocated "PDL number". > The utility that replaces a potential PDL number with a permanent > number is named "PDLNMK", and every serious MacLisp programmer knows > exactly what it does because it frequently appears in our compiled > code. This is an interesting idea; I imagine it’s a pretty big performance win, particularly since MACLISP predates generational garbage collection (and, I imagine, never had it bolted on). Consing *per se* is pretty fast in a pointer-bumping allocator; what used to kill you was the GC, and generational GC largely solved that problem. Still, I'm pretty sure that Java, LuaJIT, Chez Scheme, V8, and SpiderMonkey don’t box their fixnums. > There's a paper by Guy Steele titled "Fast Arithmetic in MacLisp" that > describes all these techniques in detail: <hdl.handle.net/1721.1/6279>. Thank you very much! I’d never read it. For the peanut gallery, that’s AIM-421.pdf, MD5 158106732f63bf268ffe4c1728950710. Kragen
Back to alt.folklore.computers | Previous | Next — Next in thread | Find similar | Unroll thread
boxing all integers (was Re: Resources to learn common lisp?) Kragen Javier Sitaker <kragen@canonical.org> - 2026-08-29 17:52 -0300
Re: boxing all integers (was Re: Resources to learn common lisp?) Alan Bawden <alan@csail.mit.edu> - 2026-08-30 17:24 -0400
Re: boxing all integers (was Re: Resources to learn common lisp?) Kragen Javier Sitaker <kragen@canonical.org> - 2026-08-31 03:11 -0300
origin of XGP fonts (was Re: reprints of old AI memos) Kragen Javier Sitaker <kragen@canonical.org> - 2026-09-28 10:44 -0300
Re: origin of XGP fonts (was Re: reprints of old AI memos) Peter Flass <Peter@Iron-Spring.com> - 2026-09-28 07:33 -0700
Re: origin of XGP fonts (was Re: reprints of old AI memos) Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-09-28 22:53 +0800
csiph-web