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, 17 Sep 2016 09:10:52 +0200

Thanks again for your feedback.

On Sat, Sep 10, 2016 at 9:55 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
What'd be the benefit?  You do want to `defvar' them in order to give
them a doctring (which means that if you want them void you have to do
extra gymnastic), and giving them a good default value means you can
call them without having to check the value beforehand (and that also
means you can use `add-function' on it).

Nothing, but I couldn't think of any downsides either before you
mentioned them. I see now that a `defvar' is better.

`buffer-hash` is only a problem in large buffers.  But you can use
buffer-text-modified-tick to get a much quicker test (only important in
large buffers).  And you might not even need to test
buffer-text-modified-tick because you can often just flush the (relevant
part of) the cache(s) from an after-change-functions or from
syntax-propertize or ...

OK, I changed it to use the buffer's tick counter instead. I also
changed `seq-uniq' to `delete-dups', which resulted in a massive
speedup. Some benchmarks using the same test files as before follow.

* With `seq-uniq':
(benchmark 10 '(css--foreign-completions 'css-class-list-function))
   "Elapsed time: 4.198944s (0.911449s in 60 GCs)"

* With `delete-dups':
(benchmark 10 '(css--foreign-completions 'css-class-list-function))
   "Elapsed time: 0.282890s (0.188205s in 10 GCs)"

As a side note, maybe a hashing strategy like the one `delete-dups'
uses would be good for `seq-uniq' too?

You don't need the boundp test here, AFAICT.

Right, removed.

-- 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]