Article View: comp.lang.lisp
Article #86Re: read-file for sbcl
From: steve g
Date: Sun, 29 Nov 2026 23:29
Date: Sun, 29 Nov 2026 23:29
65 lines
3268 bytes
3268 bytes
Alexander Schreiber <als@usenet.thangorodrim.de> writes: > What ... are you doing? In SBCL with the sb-posix module (and all of that > is about 3300 lines of Lisp, which includes win32 support as well as tests) > getting the size of the file via sb-posix via libc via the kernel is just > one line: (sb-posix:stat-size (sb-posix:stat "/etc/hosts")) Again I am using LSEEK to preload the cache. _This is implementation specific_. If you enabled the caching option in your linux kernel, This will probably work a bit better. >>> 4. i cant imagine in 2020s linux hw where this would make a practical >>> difference >> >> That's what I said 20 years ago. >> >> Stat must load lots of stuff into memory. > > Yeah, it has to read an entire block from storage (512/4096 bytes depending > on details). Linux likes number 4096. > All because the inode on ext4 by default is an absolutely massive > 256 bytes. And that assumes fully cold caches. ext2 is much faster. >> When using lseek to get the >> length of the file it is ``kinda loaded into memory'' or a cache. > > About that ... where do you think the kernel gets the size of the file? from the inode? > And how do you think that informations "gets kinda loaded in memory" (and > that phrase is quite telling)? Ummm? Like I said there is a kerel option for caching. Maybe the kernel? > Yes, the kernel reads the inode from disk. > Although in reality, is has done so when you opened the file for > lseek(2) Correct. > so for the stat call it already has that data. stat uses memory that I do not need. >> Believe me my SCSI drives definitely knew the difference between cached >> io and scatter brain read. > Because cached IO (at the OS level) doesn't touch the drive. SCSI drives run on their own bios before loading the operating system. This is usually done in the SCSI bios. it depends on your scsi disk controller. Anyways, why do you care? Fucking children.
Technical Details
Message-ID:
<878q2bdxn1.fsf@gmail.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!weretis.net!feeder9.news.weretis.net!border-2.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mailReferences:
<87ld6gl8ah.fsf@gmail.com> <m3wlq0ut1c.fsf@pison.robolove.meer.net> <87ld6dhbsc.fsf@gmail.com> <slrn11glf2d.1hn9k.als@mordor.angband.thangorodrim.de>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!weretis.net!feeder9.news.weretis.net!border-2.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 29 Nov 2026 23:29:55 +0000 From: steve g <Sgonedes1977@gmail.com> Newsgroups: comp.lang.lisp Subject: Re: read-file for sbcl References: <87ld6gl8ah.fsf@gmail.com> <m3wlq0ut1c.fsf@pison.robolove.meer.net> <87ld6dhbsc.fsf@gmail.com> <slrn11glf2d.1hn9k.als@mordor.angband.thangorodrim.de> Date: Sun, 29 Nov 2026 18:29:54 -0500 Message-ID: <878q2bdxn1.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:AHl4hp5lJxxBt+o1VsmcH/EOGEw= MIME-Version: 1.0 Content-Type: text/plain Lines: 65 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-KdWNOEq22GN9orJ5P0PwlcMq3bX4OV8UpSqOY6KT1hSx+hJhivTOOXOuPyhvJ0R4xycE0JBP1xP/xC+!Wl86f4B90jFWXgw3cNoCqomunAxpP5/bZgUyn0vWGCotUXo= X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40