Re: 3 questions about arrays
- From: Paul Wallich <pw@xxxxxxxxx>
- Date: Thu, 03 Dec 2009 20:49:51 -0500
Spiros Bousbouras wrote:
On Fri, 04 Dec 2009 01:10:12 +0100
pjb@xxxxxxxxxxxxxxxxx (Pascal J. Bourguignon) wrote:
Spiros Bousbouras <spibou@xxxxxxxxx> writes:
1. (setq *PRINT-ARRAY* t)No, it is implementation dependant, but not undefined.
(make-array 1)
Is this undefined behavior ?
The HS page on make-array says "If initial-element is not supplied, the
consequences of later reading an uninitialized element of new-array are
undefined unless either initial-contents is supplied or displaced-to is
non-nil". In order to print the elements of the array doesn't the
implementation need to read them ? If yes then it's undefined behavior.
2. Why the requirement that the dimensions of an array are fixnums ?Why not? This is not a big restriction, if an implementation wants
bigger arrays, it only has to provide bigger fixnums.
fixnums are supposed to be efficient , that's the criterion for
choosing the size of fixnums not the maximum size of arrays. On the
other hand the maximum size of arrays should be what the operating
system can handle even if it means that part of the array would be in
swap memory.
Nuh-uh.
1) That's already the case in plenty of CL implementations -- unless a lot of people have 60 bits of physical memory they're not telling anyone about. (Even on 32-bit operating systems, a single fixnum-denominated array can already use up at least all of physical memory and quite possibly more, depending on what's in the array.)
2) Now array-size limit depends not on the lisp but on the OS and the disks you have handy and how much someone allocated for /swap and what other programs are running. Good luck with that. Or do you just mean the maximum allocatable file size, in which case array-size limit varies dynamically with the contents of the array?
3) Abandoning the fixnum limit, especially given adjustability, is potentially really bad for performance even for arrays that aren't bigger than that limit; if you want really bad performance, you can roll it yourself.
4) The problem has historically been with array-size-limit rather smaller than the fixnum limit.
Speaking of which, does anyone remember the source of a quote that goes something like "There's a problem with arrays larger than memory; in particular, they have to be paged in twice to create them"?
paul
.
- Follow-Ups:
- Re: 3 questions about arrays
- From: Spiros Bousbouras
- Re: 3 questions about arrays
- References:
- 3 questions about arrays
- From: Spiros Bousbouras
- Re: 3 questions about arrays
- From: Spiros Bousbouras
- 3 questions about arrays
- Prev by Date: Re: 3 questions about arrays
- Next by Date: Re: 3 questions about arrays
- Previous by thread: Re: 3 questions about arrays
- Next by thread: Re: 3 questions about arrays
- Index(es):
Relevant Pages
|