From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Converting CC Mode's obarrays to hash tables. [Was: new `obarray` type] Date: Sun, 23 Jul 2017 14:03:10 +0000 Message-ID: <20170723140310.GA2551@acm> References: <20170313220335.GA5098@acm> <20170314201414.GA4562@acm> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1500818690 20217 195.159.176.226 (23 Jul 2017 14:04:50 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 23 Jul 2017 14:04:50 +0000 (UTC) User-Agent: Mutt/1.7.2 (2016-11-26) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 23 16:04:46 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZHUv-0004rt-Kn for ged-emacs-devel@m.gmane.org; Sun, 23 Jul 2017 16:04:41 +0200 Original-Received: from localhost ([::1]:50580 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZHV1-0000k2-84 for ged-emacs-devel@m.gmane.org; Sun, 23 Jul 2017 10:04:47 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35130) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZHUu-0000jr-Ix for emacs-devel@gnu.org; Sun, 23 Jul 2017 10:04:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZHUr-0002rL-9b for emacs-devel@gnu.org; Sun, 23 Jul 2017 10:04:40 -0400 Original-Received: from ocolin.muc.de ([193.149.48.4]:15857 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1dZHUr-0002o1-2Y for emacs-devel@gnu.org; Sun, 23 Jul 2017 10:04:37 -0400 Original-Received: (qmail 15273 invoked by uid 3782); 23 Jul 2017 14:04:33 -0000 Original-Received: from acm.muc.de (p548C708F.dip0.t-ipconnect.de [84.140.112.143]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 23 Jul 2017 16:04:32 +0200 Original-Received: (qmail 14641 invoked by uid 1000); 23 Jul 2017 14:03:10 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.4 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:216945 Archived-At: Hello, Stefan. On Wed, Mar 15, 2017 at 13:25:08 -0400, Stefan Monnier wrote: > > There are currently four uses of (make-vector LENGTH 0) in CC Mode, at > > least one of which, possibly two, genuinely deal with Lisp symbols. > > Converting those to hash-tables would probably be a net loss, though > > converting the ones which just use obarrays as a string look-up would > > surely gain. > I just tried such a conversion on all 4 uses. > The result isn't that bad, but indeed contrary to the EIEIO case, I get > a slight slow down (somewhat lost in the measurement noise, but still > a disappointment for me). The culprit seems to be the use of cl-structs > instead of symbols in c-lang-constants (I can recover some of the speed > by adding (:type vector) (:named nil) to the defstruct definition). I've just converted c-found-types to use a hash table. The result was a slight, but measurable and worthwhile, speed increase, of between 1% and 2%. As for c-keywords-obarray (an obarray which has C (etc.) keywords as its symbols, whose property lists contain the various keyword categories the keywords belong to) - what is the benefit of holding collections of symbols in hash tables rather than obarrays? If this makes a program faster, it suggests that the obarray implementation could be improved to match the speed of the hash table implementation. Why don't we store the main Emacs obarray in a hash table, if this will increase speed? > In case you're interested in extracting the rest, find the patch below > (which was pretty thoroughly *un*tested), Thanks, I read it. > Stefan [ .... ] -- Alan Mackenzie (Nuremberg, Germany).