aptinio / text-table

A feature-rich, easy-to-use plain text table formatter.
MIT License
96 stars 14 forks source link

Perfomance issue with large amount of rows #4

Closed ZuBB closed 11 years ago

ZuBB commented 12 years ago

Hi there!

I using your gem for formatting sql results. It does it really nice, but my script "hangs up" when I am trying to process large array (30K of rows). below are 10 rows of data as example

+------------------+--------------------------------------+------------------------------------+------------------------+------------------------------+---------------+
| titanium_version | app_guid                             | appid_str                          | app_name               | email                        | session_count |
+------------------+--------------------------------------+------------------------------------+------------------------+------------------------------+---------------+
| NULL             | fbdbfd86-9754-4d67-9ed9-84ec56fcb52e | jp.tamalala.tamalala               | tamalala               | xxxxx@gmail.com        |       2426609 |
| NULL             | fc1d6462-5166-406f-9e8f-3b2412a8ee58 | jp.pcrs.dynamicStateController     | DynamicStateController | xxxxx@gmail.com       |       1449399 |
| NULL             | 3e8b8e6d-6113-4e79-b151-4c0beb543849 | com.cyberantix.flashcards          | Flashcards             | xxxxx@letsbeglobal.com      |        456229 |
| NULL             | 7438038b-0d8f-420a-becf-d57f4e7c1106 | com.chatmatch                      | chatmatch              | xxxxx@gmail.com       |        444985 |
| NULL             | f5054795-45fe-48b2-9038-95366b1a6349 | com.dhservices.mister              | Mister1                | xxxxx@logicallabs.com  |        426619 |
| NULL             | 92456fc8-7dd2-4593-881a-67d302d765bc | com.primedia.mobile.apartmentguide | ApartmentGuide         | xxxxx@primedia.com     |        237382 |
| NULL             | 8c14c553-9dc4-4578-b65d-2dacb6ff10dd | com.gamestop.app                   | GameStop               | xxxxx@gamestop.com      |        230886 |
| NULL             | 87aced76-b54f-45a9-89eb-005faf5c9600 | instaDM.cris.mx                    | instaDM                | xxxxx@cris.mx                |        171498 |
| 1.8.1            | 87aced76-b54f-45a9-89eb-005faf5c9600 | instaDM.cris.mx                    | instaDM                | xxxxx@cris.mx                |        166266 |
| NULL             | bb6444e3-dbc8-4aa7-b870-a3aab80dbfe1 | com.arrivalguides.mobile           | ArrivalGuides          | xxxxx@gmail.com |        147907 |
+------------------+--------------------------------------+------------------------------------+------------------------+------------------------------+---------------+

as workaround I suggest to add a method that will return formatted row by given index so users can loop through array.

aptinio commented 11 years ago

This is now fixed in version 1.2.3. Sorry for taking too long to take care of this.