[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Any disadvantages of using put/get instead of defvar?
From: |
Oleh |
Subject: |
Re: Any disadvantages of using put/get instead of defvar? |
Date: |
Fri, 21 Feb 2014 10:44:57 +0100 |
>> 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