Ticket #375 (closed enhancement: fixed)

Opened 10 months ago

Last modified 10 months ago

Cache terminal width measurement

Reported by: ruport Assigned to:
Milestone: Keywords:
Cc: b.candler@pobox.com

Description

Ruport calls SystemExtensions?.terminal_width for every row when building a text table, which under Linux calls stty with a fork/exec for every row. That's very slow.

You can cache the results either at SystemExtensions?.terminal_size, and/or in Formatter::Text#width. The attached patch does both for good measure :-)

Attachments

ruport-terminal-width.diff (1.9 kB) - added by ruport on 01/30/08 16:32:51.

Change History

01/30/08 16:32:51 changed by ruport

  • attachment ruport-terminal-width.diff added.

02/02/08 12:23:45 changed by sandal

  • status changed from new to closed.
  • resolution set to fixed.

You certainly don't want to make SystemExtensions?.terminal_size static, but caching at the Text formatter level results in an awesome speed boost.

See r1251. Thanks Brian