diff options
| author | Paul Kmiec <[email protected]> | 2023-05-13 14:21:21 -0700 |
|---|---|---|
| committer | Paul Kmiec <[email protected]> | 2023-05-15 13:49:21 -0700 |
| commit | 4627bcce04ade9c17e1d0c169100a6288195f6ac (patch) | |
| tree | 7862f4a19e3bca9f6994dca882d5ce92cc3dbf46 /test/tc_axlsx.rb | |
| parent | 3b9ac17d8e4dc8b315ac307ffad6f2aa0cb96741 (diff) | |
| download | caxlsx-4627bcce04ade9c17e1d0c169100a6288195f6ac.tar.gz caxlsx-4627bcce04ade9c17e1d0c169100a6288195f6ac.zip | |
Cache col_ref to avoid allocations
In cases with lots of rows, each column will ask for its col_ref which will
always be the same for the same column_index. We can cache this to avoid
lots of small string allocations.
Modified `CellSerializer` to use `#col_ref` and `#row_ref` avoiding the string
allocation caused by `#col_r`
Diffstat (limited to 'test/tc_axlsx.rb')
| -rw-r--r-- | test/tc_axlsx.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/test/tc_axlsx.rb b/test/tc_axlsx.rb index 95c77d88..a70722ee 100644 --- a/test/tc_axlsx.rb +++ b/test/tc_axlsx.rb @@ -83,8 +83,14 @@ class TestAxlsx < Test::Unit::TestCase end end + def test_row_ref + assert_equal('1', Axlsx.row_ref(0)) + assert_equal('100', Axlsx.row_ref(99)) + end + def test_cell_r - # todo + assert_equal('A1', Axlsx.cell_r(0, 0)) + assert_equal('Z26', Axlsx.cell_r(25, 25)) end def test_range_to_a |
