Re: [Sbcl-bugs] [BUG] WITH-OPEN-FILE registers redundant auto-close finalizer (~31% of OPEN allocation)

Douglas Katzman via Sbcl-devel <[email protected]> Wed, 11 Mar 2026 13:03:10 -0400
Newsgroups gmane.lisp.steel-bank.devel
Message-ID <CAOrNasz1jvqBbtJGNqNZejkTsww=NrQOj7Xy4jK1rkWxLaRNog@mail.gmail.com>
The patch is nice, but the sb-sprof report is completely wrong.  This is no
surprise because given the repetitive test, a "random sample" will occur at
the exact same place every time, and MAKE-SO-NODE just got unlucky
The deterministic profiler shows that SO-NODEs account for about 1.4% of
the memory allocation

       %        Bytes        Count    Function
 -------  -----------    ---------    --------
  75.7       13089600                 SB-IMPL::SET-FD-STREAM-ROUTINES
      79.6     10423200       5050        (SIMPLE-ARRAY CHARACTER (*))
      20.4      2666400       5050        (SIMPLE-ARRAY (UNSIGNED-BYTE 8)
(*))

  11.7        2020000                 SB-IMPL::%MAKE-FD-STREAM
      80.0      1616000       5050        SB-SYS:FD-STREAM
      16.0       323200       5050        SB-VM::ARRAY-HEADER
       4.0        80800       5050        (SIMPLE-ARRAY CHARACTER (*))

   2.8         484912                 SB-KERNEL:VECTOR-SUBSEQ
     100.0       484800      15150        SIMPLE-BASE-STRING
      00.0          112          3        (SIMPLE-ARRAY CHARACTER (*))

   2.3         404000        10100    GET-OUTPUT-STREAM-STRING -
SIMPLE-BASE-STRING
   1.9         323200         5050    SB-KERNEL:%CONCATENATE-TO-STRING -
(SIMPLE-ARRAY CHARACTER (*))
   1.4         242400        15150    SB-IMPL::UNPARSE-NATIVE-PHYSICAL-FILE
- LIST
   1.4         242400         5050    SB-LOCKLESS::MAKE-SO-NODE -
SB-LOCKLESS::SO-DATA-NODE

   0.9         161632                 SB-IMPL::PARSE-UNIX-NAMESTRING
      50.0        80816       5051        LIST
      50.0        80816       5051        CONS

   0.9         161600         5050    SB-SYS:MAKE-FD-STREAM - FUNCTION
   0.5          80800         5050    FINALIZE - SB-VM::VALUE-CELL
   0.5          80800         5050    SB-IMPL::RELEASE-BUFFER - LIST
   0.0              0            0    SB-VM::FILLER - SB-VM::FILLER
 =======  ===========
 100.0       17291344

_______________________________________________
Sbcl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sbcl-devel