From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.gnus.general,gmane.emacs.devel Subject: Re: require inside functions. (was: Changes in calendar/time-date.el) Date: Fri, 08 Apr 2005 10:12:00 +0200 Message-ID: References: <871x9w9dkn.fsf@xs4all.nl> <87mzsezu5f.fsf@xs4all.nl> <87hdimzou0.fsf@xs4all.nl> <87ll7uwy6m.fsf_-_@xs4all.nl> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1112948140 14040 80.91.229.2 (8 Apr 2005 08:15:40 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 8 Apr 2005 08:15:40 +0000 (UTC) Cc: Lute Kamstra , miles@gnu.org, snogglethorpe@gmail.com, reiner.steib@gmx.de, ding@gnus.org, emacs-devel@gnu.org Original-X-From: ding-owner+M8648@lists.math.uh.edu Fri Apr 08 10:15:37 2005 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DJoe2-0006IU-Mt for ding-account@gmane.org; Fri, 08 Apr 2005 10:15:15 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu ident=lists) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1DJobd-0002UL-00; Fri, 08 Apr 2005 03:12:45 -0500 Original-Received: from util2.math.uh.edu ([129.7.128.23]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1DJobX-0002UG-00 for ding@lists.math.uh.edu; Fri, 08 Apr 2005 03:12:39 -0500 Original-Received: from quimby.gnus.org ([80.91.224.244]) by util2.math.uh.edu with esmtp (Exim 4.30) id 1DJobO-0002d7-GN for ding@lists.math.uh.edu; Fri, 08 Apr 2005 03:12:30 -0500 Original-Received: from mail-relay.sonofon.dk ([212.88.64.25]) by quimby.gnus.org with smtp (Exim 3.35 #1 (Debian)) id 1DJobE-0003hp-00 for ; Fri, 08 Apr 2005 10:12:21 +0200 Original-Received: (qmail 49559 invoked from network); 8 Apr 2005 08:12:16 -0000 Original-Received: from unknown (HELO kfs-l.imdomain.dk.cua.dk) (213.83.150.2) by 0 with SMTP; 8 Apr 2005 08:12:16 -0000 Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Thu, 07 Apr 2005 23:22:22 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-Spam-Score: -4.9 (----) Precedence: bulk Original-Sender: ding-owner@lists.math.uh.edu Xref: news.gmane.org gmane.emacs.gnus.general:60121 gmane.emacs.devel:35746 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:35746 Richard Stallman writes: > (require 'ft) only loads a file if 'ft is not in features. However, > it unconditionally adds '(require . ft) to current-load-list. If you > call a function with require a million times, this eats up 16 MB of > memory. > > This was done deliberately. The idea is that it's useful > to record that file foo depends on file bar, even if bar > was already loaded before foo. It is not _file_ foo, but _function_ foo that did (require 'bar). Why is it useful to record that? For what purpose? There is no active "load" or "autoload" in progress, so the require is done in "interactive" context. > > However, it isn't useful to record (require . bar) an additional time > in current-load-list when it's already there. So I think the right fix > is to check with Fmember and not add it a second time. Which means that (require 'bar) called from a function will definitely be slowed down (depending on the length of current-load-list)! Would it work to only add to current-load-list if loading != 0 ? -- Kim F. Storm http://www.cua.dk