bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#24389: [PATCH] Support completion of classes and IDs in CSS mode


From: Simen Heggestøyl
Subject: bug#24389: [PATCH] Support completion of classes and IDs in CSS mode
Date: Sat, 10 Sep 2016 14:13:13 +0200

Hi Stefan, thanks for the feedback.

On Wed, Sep 7, 2016 at 10:01 PM, Stefan Monnier <monnier@IRO.UMontreal.CA> wrote:
I don't see where this is used.

Oops, that was left over from an earlier revision.

I urge you to use alists rather than plist whenever you can.  I only
recommend plists for those rare cases where they're likely to often be
written down by end-users who'd be bothered by the need to add dots
and parentheses.

Noted, thanks.

I think this design won't work well.  How 'bout instead just always
calling the function and let the other side handle the caching?

This way the cache can work correctly even in case the list of
completions depends on sources other than the buffer's content (a case
which even your costly buffer-hash won't catch).  Also, it means that
depending on the cost of the extraction itself, the cache may be flushed
more or less eagerly.

True. Considering the things you've mentioned, I also think it will be
much better to let the other side (optionally) handle their own
cache. Please see the revised patch.

The definition of those global variables seems to be missing.
IIUC they should be in css-mode.el, so their name should start with
"css-" I think (tho I agree that it's debatable).

Hm, is it wrong to let them stay void, and then check whether they're
bound in each buffer we visit?

I ran som benchmarks to assess whether the expensive buffer-hash cache
is worth it, results follow below. All the tests were run with 583 HTML
mode buffers open, with content totaling 7.5 MB.

* No cache:
(benchmark 1 '(css--foreign-completions 'css-class-list-function))
   "Elapsed time: 1.597629s (0.797973s in 55 GCs)"
(benchmark 10 '(css--foreign-completions 'css-class-list-function))
   "Elapsed time: 15.322130s (7.589323s in 549 GCs)"

* Cold cache:
(benchmark 1 '(css--foreign-completions 'css-class-list-function))
   "Elapsed time: 1.609650s (0.786968s in 54 GCs)"

* Warm cache:
(benchmark 1 '(css--foreign-completions 'css-class-list-function))
   "Elapsed time: 0.471924s (0.102814s in 6 GCs)"
(benchmark 10 '(css--foreign-completions 'css-class-list-function))
   "Elapsed time: 4.376787s (0.981541s in 59 GCs)"

-- Simen

Attachment: 0001-Support-completion-of-classes-and-IDs-in-CSS-mode.patch
Description: Text Data


reply via email to

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