emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hash table GC


From: Anand Tamariya
Subject: Re: Hash table GC
Date: Tue, 15 Oct 2024 13:18:10 +0530

I'm trying to use a hash table for storing parsed CSS values. I'm seeing a degradation in performance (memory and CPU) over a period of time. Trying to investigate how to fix the same. Below is a minimal example:

(dotimes (i 10000)
  (let* ((a (make-hash-table :test 'equal :weakness 'key-or-value))
(j 0))
    (dolist (prop '(padding margin margin-top border
                            color background background-color display
                            width height clear
                            font font-size font-style font-weight))
      (puthash j (list prop (setq j (1+ j))) a))
    (pp a)
    ))
(Emacs 28.2 on Debian)

On Mon, Oct 14, 2024 at 7:30 PM Eli Zaretskii <eliz@gnu.org> wrote:
> From: Anand Tamariya <atamariya@gmail.com>
> Date: Mon, 14 Oct 2024 10:02:24 +0530
>
> If I've created a hash table with :weakness nil, how do I release it for GC when it is no longer needed?

Why are you asking specifically about hash-tables?  AFAIK, they are
not different from any other Lisp object in this regard.  Weakness
affects GC of the keys and values, not of the table itself, AFAIU.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]