From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Oleh Newsgroups: gmane.emacs.help Subject: Re: Any disadvantages of using put/get instead of defvar? Date: Fri, 21 Feb 2014 10:44:57 +0100 Message-ID: References: <87ob218lsu.fsf@thinkpad-t61.fritz.box> <87bny0x0rx.fsf@thinkpad-t61.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1392975911 3887 80.91.229.3 (21 Feb 2014 09:45:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 21 Feb 2014 09:45:11 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Tassilo Horn Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Feb 21 10:45:19 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WGmfX-0002N0-AH for geh-help-gnu-emacs@m.gmane.org; Fri, 21 Feb 2014 10:45:19 +0100 Original-Received: from localhost ([::1]:43340 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGmfW-0000sL-Uy for geh-help-gnu-emacs@m.gmane.org; Fri, 21 Feb 2014 04:45:18 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35437) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGmfH-0000pj-9N for help-gnu-emacs@gnu.org; Fri, 21 Feb 2014 04:45:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WGmfG-0002zE-Et for help-gnu-emacs@gnu.org; Fri, 21 Feb 2014 04:45:03 -0500 Original-Received: from mail-wg0-x22c.google.com ([2a00:1450:400c:c00::22c]:59411) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGmfC-0002wl-5o; Fri, 21 Feb 2014 04:44:58 -0500 Original-Received: by mail-wg0-f44.google.com with SMTP id k14so2313092wgh.11 for ; Fri, 21 Feb 2014 01:44:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=zJUxuIR8MPQ1zYNwMA2tKdlr52qUEtLzNtPdAcldNBI=; b=swlc4GNPBBpmMvcGa8U0mBvVEdQ+yJgyglEl/jGbfnDYluOgbM+jmzga7bF+kRHp7p fBLqQyrQQCG2yaKkOxRWrJfZEAjfGDwCqcG8m1mMhsVSH7Fn7znL2snRHIR7HGfq2J/e Ew92AJRVOw7XbhGZc8z8NSCIFY9mwraKxM5g1SICU9yADs9O78B92IveDskDtSDQ79xz LoGE8Gkb2mbIDmSAjss29XuylkvdSfEVrJXahaOO74ZesOjl/KZGLNS16XMM6H+WYfb4 MmYZul2mmM+sxOQHAXgHjO49qdlBN79CFx91yIQPVp+E34h22r+NDP8slpR+EE3aSjwf caGQ== X-Received: by 10.195.13.17 with SMTP id eu17mr6314789wjd.24.1392975897114; Fri, 21 Feb 2014 01:44:57 -0800 (PST) Original-Received: by 10.227.147.68 with HTTP; Fri, 21 Feb 2014 01:44:57 -0800 (PST) In-Reply-To: <87bny0x0rx.fsf@thinkpad-t61.fritz.box> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c00::22c X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:96149 Archived-At: >> But doesn't `defvar` introduce overhead this way? > > Well, I've measured my counter above versus a version using symbol > properties as you suggest: > > (defun bar () > (let ((foo (or (get 'bar 'foo) 1))) > (put 'bar 'foo (1+ foo)))) > > My counter is way faster although it uses defvar and setq-local, so that > overhead is still small compared to looking up/putting a symbol > property. > Thanks, your suggestion wins then, since it's both pretty and fast. If there's no new info in this issue, I'll just use your mehtod. regards, Oleh