Project

General

Profile

Feature #13721

[PATCH] net/imap: dedupe attr keys in Net::IMAP::FetchData

Added by normalperson (Eric Wong) 3 months ago. Updated 2 months ago.

Status:
Assigned
Priority:
Normal
Target version:
-
[ruby-core:81926]

Description

Since attr hash keys are frequently reused, it makes sense to
deduplicate them up front.

This saves one allocation per-attr, per-message. When running
imap.fetch(1..-1, 'UID') on a mailbox with 30000 messages;
this saves 30000 allocations.

This relies on the String#-@ change in [Feature #13077]

  • net/imap: use frozen, deduplicated string in attr name (key)

Trivial (1-byte change :), I may commit in a few days if no response.

History

#1 [ruby-core:82110] Updated by shugo (Shugo Maeda) 2 months ago

  • Assignee set to shugo (Shugo Maeda)
  • Status changed from Open to Assigned

#2 [ruby-core:82174] Updated by shugo (Shugo Maeda) 2 months ago

  • Assignee changed from shugo (Shugo Maeda) to normalperson (Eric Wong)

normalperson (Eric Wong) wrote:

Since attr hash keys are frequently reused, it makes sense to
deduplicate them up front.

This saves one allocation per-attr, per-message. When running
imap.fetch(1..-1, 'UID') on a mailbox with 30000 messages;
this saves 30000 allocations.

This relies on the String#-@ change in [Feature #13077]

  • net/imap: use frozen, deduplicated string in attr name (key)

Trivial (1-byte change :), I may commit in a few days if no response.

Sounds reasonable. Could you commit it on your own?

#3 [ruby-core:82198] Updated by normalperson (Eric Wong) 2 months ago

shugo@ruby-lang.org wrote:

Sounds reasonable. Could you commit it on your own?

Thanks. But maybe we can do it across-the-board
with [Feature #13725] (which was reverted with )

I haven't had time to fix #13725 (sorry, having trouble focusing
on coding, lately).

Also available in: Atom PDF