Closed tp2750 closed 1 year ago
Hi @tp2750 !
Unfortunately, it will not change anything regarding the loading time. TerminalPager.jl is not data aware. Hence, it does not know if we are rendering a matrix, a vector, Markdown, etc. When you call pager
, it immediately calls show
to render the object to a string. The slow process is in this step.
It will be very complicated to support different types of objects in TerminalPager.jl. What we need to do, and I am thinking about it, is creating a new package called TablesPager.jl or something that uses the code here to render objects that follows Tables.jl API. In this case, we can solve this slowdown for all Tables.jl.
Thank you for the reply @ronisbr
It sounds like a table specific pager would be great. I'll close this for now then.
It is already a great package for tables :-)
Thanks a lot!
Perfect! I have some ideias and a TablesPages would solve a lot of problems :)
As mentioned in #10 it can take a long time to load a large table, and in many cases, I do not actually want to page through thousands of rows.
Would it be ok to add an optional second argument to only load the first n lines?
As example:
Then
pager(d1, 100)
should conceptually do the same aspager(first(d1,100))
.For DataFrames the overhead of writing
pager(first(d1,100))
rather thanpager(d1, 100)
is not so big, but for matrices we would need to writepager(m1[1:100,:])
:We could also consider a third argument to limit the number of columns, but in practice, I find that tables tend to be taller rather than wider.
Just be clear: the use case is to allow the user an easy way to specify that the table is large, and it is ok to only load the first n lines with the limitations that gives. E.g. that searching will only happen in that first part of the table.