unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] feature/byte-switch c4316a2: ; bytecomp.el (byte-compile-cond-jump-table): Add TODO note
       [not found] ` <20170206140315.229CD220145@vcs.savannah.gnu.org>
@ 2017-02-06 15:35   ` Stefan Monnier
  2017-02-06 16:26     ` Clément Pit-Claudel
  2017-02-06 16:57     ` Vibhav Pant
  0 siblings, 2 replies; 6+ messages in thread
From: Stefan Monnier @ 2017-02-06 15:35 UTC (permalink / raw)
  To: emacs-devel; +Cc: Vibhav Pant

> +      ;; TODO: Once :linear-search is implemented for `make-hash-table'
> +      ;; set it to `t' for cond forms with a small number of cases.

Indeed, we can probably substantially improve our hash-table performance
for small hash tables (not only in terms of CPU use but also in terms of
memory use).

But rather than a :linear-search keyword to make-hash-table, can't we
just test the value of `count` and use a linear search if it's small?


        Stefan



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Emacs-diffs] feature/byte-switch c4316a2: ; bytecomp.el (byte-compile-cond-jump-table): Add TODO note
  2017-02-06 15:35   ` [Emacs-diffs] feature/byte-switch c4316a2: ; bytecomp.el (byte-compile-cond-jump-table): Add TODO note Stefan Monnier
@ 2017-02-06 16:26     ` Clément Pit-Claudel
  2017-02-06 16:57     ` Vibhav Pant
  1 sibling, 0 replies; 6+ messages in thread
From: Clément Pit-Claudel @ 2017-02-06 16:26 UTC (permalink / raw)
  To: Stefan Monnier, emacs-devel; +Cc: Vibhav Pant

On 2017-02-06 10:35, Stefan Monnier wrote:
> Indeed, we can probably substantially improve our hash-table performance
> for small hash tables (not only in terms of CPU use but also in terms of
> memory use).
> 
> But rather than a :linear-search keyword to make-hash-table, can't we
> just test the value of `count` and use a linear search if it's small?

This would be great.  I currently have quite a bit of hash-table-heavy code with many relatively small hash tables, but in a few rare cases they can grow large, so alists don't cut it.  A linear-search keyword wouldn't really help, because I can't tell beforehand which ones will be large.

Clément.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Emacs-diffs] feature/byte-switch c4316a2: ; bytecomp.el (byte-compile-cond-jump-table): Add TODO note
  2017-02-06 15:35   ` [Emacs-diffs] feature/byte-switch c4316a2: ; bytecomp.el (byte-compile-cond-jump-table): Add TODO note Stefan Monnier
  2017-02-06 16:26     ` Clément Pit-Claudel
@ 2017-02-06 16:57     ` Vibhav Pant
  2017-02-06 17:27       ` Stefan Monnier
  1 sibling, 1 reply; 6+ messages in thread
From: Vibhav Pant @ 2017-02-06 16:57 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel@gnu.org

On Mon, Feb 6, 2017 at 9:05 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> But rather than a :linear-search keyword to make-hash-table, can't we
> just test the value of `count` and use a linear search if it's small?

Indeed. That should take less to code to implement too.

-- 
Vibhav Pant
vibhavp@gmail.com



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Emacs-diffs] feature/byte-switch c4316a2: ; bytecomp.el (byte-compile-cond-jump-table): Add TODO note
  2017-02-06 16:57     ` Vibhav Pant
@ 2017-02-06 17:27       ` Stefan Monnier
  2017-02-06 17:40         ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2017-02-06 17:27 UTC (permalink / raw)
  To: emacs-devel@gnu.org

>> But rather than a :linear-search keyword to make-hash-table, can't we
>> just test the value of `count` and use a linear search if it's small?

Nitpick: actually, it should be based on the hash-table's *size* rather
than its *count*.


        Stefan



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Emacs-diffs] feature/byte-switch c4316a2: ; bytecomp.el (byte-compile-cond-jump-table): Add TODO note
  2017-02-06 17:27       ` Stefan Monnier
@ 2017-02-06 17:40         ` Stefan Monnier
  2017-02-06 18:22           ` Vibhav Pant
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2017-02-06 17:40 UTC (permalink / raw)
  To: emacs-devel

>>> But rather than a :linear-search keyword to make-hash-table, can't we
>>> just test the value of `count` and use a linear search if it's small?
> Nitpick: actually, it should be based on the hash-table's *size* rather
> than its *count*.

For me, the place where small hash tables showed up is in cl-generic,
where many of them have just a single entry.
For byte-switch, optimizing the single-entry case is not important (you
wouldn't want to use byte-switch for it), tho.


        Stefan




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Emacs-diffs] feature/byte-switch c4316a2: ; bytecomp.el (byte-compile-cond-jump-table): Add TODO note
  2017-02-06 17:40         ` Stefan Monnier
@ 2017-02-06 18:22           ` Vibhav Pant
  0 siblings, 0 replies; 6+ messages in thread
From: Vibhav Pant @ 2017-02-06 18:22 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 253 bytes --]

On 06-Feb-2017 11:25 PM, "Stefan Monnier" <monnier@iro.umontreal.ca> wrote:

For byte-switch, optimizing the single-entry case is not important (you
wouldn't want to use byte-switch for it), tho.


byte-compile-cond-jump-table does check for that, yes.

[-- Attachment #2: Type: text/html, Size: 718 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-02-06 18:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20170206140314.23384.66886@vcs.savannah.gnu.org>
     [not found] ` <20170206140315.229CD220145@vcs.savannah.gnu.org>
2017-02-06 15:35   ` [Emacs-diffs] feature/byte-switch c4316a2: ; bytecomp.el (byte-compile-cond-jump-table): Add TODO note Stefan Monnier
2017-02-06 16:26     ` Clément Pit-Claudel
2017-02-06 16:57     ` Vibhav Pant
2017-02-06 17:27       ` Stefan Monnier
2017-02-06 17:40         ` Stefan Monnier
2017-02-06 18:22           ` Vibhav Pant

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).