unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jesper Harder <harder@myrealbox.com>
Subject: Re: Does network data really cons strings?
Date: Tue, 13 Jan 2004 04:17:18 +0100	[thread overview]
Message-ID: <m34qv0a669.fsf@defun.localdomain> (raw)
In-Reply-To: 40032235.3050709@yahoo.com

Kevin Rodgers <ihs_4664@yahoo.com> writes:

> Jesper Harder wrote:
>
>> I was a bit surprised to see that network data (or any data received
>> from processes) conses Lisp strings.
>>
>> Is it just a quirk of `memory-use-counts' or is it for real?  Why
>> does it need to cons Lisp strings if the data is only inserted in a
>> buffer?
>
> So that the data is available to the process filter?

Right, it would need to cons strings if there are filters.  But it
also happens when there are no filters.

Hmm, I now notice that it also conses cons cells like mad:

(let (m1 process)
    (with-current-buffer (get-buffer-create " *test*")
      (erase-buffer))
    (setq process (open-network-stream "test" " *test*" "news.gmane.org" 119))
    (setq m1 (memory-use-counts))
    (process-send-string process "LIST\n")
    (sit-for 50)
    (process-send-string process "QUIT\n")
    (mapcar* '- (memory-use-counts) m1))

=> (48055 3 0 0 509059 2 0 2063)

(with-current-buffer " *test*" (buffer-size))
=> 252123

Roughly two char-cells for every byte of data received!  That seems
rather excessive ... and I wonder what all those cons cells are used
for.

Emacs 20.5 seems to do _far_ better for the same data (on a faster
network connection, though):

     (4103 0 0 0 4168 0 0)

  reply	other threads:[~2004-01-13  3:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-12 21:41 Does network data really cons strings? Jesper Harder
2004-01-12 22:39 ` Kevin Rodgers
2004-01-13  3:17   ` Jesper Harder [this message]
2004-01-13 16:58     ` Kevin Rodgers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m34qv0a669.fsf@defun.localdomain \
    --to=harder@myrealbox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).