zhiburt / tabled

An easy to use library for pretty print tables of Rust structs and enums.
MIT License
1.95k stars 79 forks source link

Comparison with other table libraries #139

Open danieleades opened 2 years ago

danieleades commented 2 years ago

There are now a few libraries for pretty-printing tables to the console. It would be really helpful to have a bit of a comparison to allow users (including myself!) to determine which one to go for.

zhiburt commented 2 years ago

Hi @danieleades

There are now a few libraries for pretty-printing tables to the console. It would be really helpful to have a bit of a comparison to allow users (including myself!) to determine which one to go for.

Yes there's a list of ones.

Someone (me) just frighten to see a bad performance :sweat_smile: :disappointed_relieved:

But I think you're right it must be done.

Thank you for bringing this up.

zhiburt commented 2 years ago

Here's a run I made against your list of libraries against #148;

You can find benchmark in comparision-libs-bench branch.

(We are not the best :disappointed_relieved: but we OK I think)

Screenshot_2022-05-25_18-01-44

Screenshot_2022-05-25_18-02-17

image

I guess we can publisize them in the README.md or make a reference on it. But I guess there would need to be done 3 things:

  1. Make a memory benchmark.
  2. Do a research if there's anything of these libs worth to be mentioned; to give them credit.
  3. Write the authors in regard if they're OK with it.

PS: 4. Try to make tabled faster :smile:

zhiburt commented 2 years ago

A few improvements; (at least I hope so :disappointed_relieved: )

image

image

danieleades commented 2 years ago

that's pretty impressive. Good to see a speed comparison

That said, for most applications I can think of a for a CLI table library, unless the performance is particularly egregious, it's probably not would sell me on one library over another. I was more thinking about a comparison of API surface. Are there things that can be achieved with your library that can't be achieved with the others? Is the approach better for certain problems?

Nukesor commented 2 years ago

Hey :) @zhiburt

I finally found the time to properly respond on my sibling ticket :D https://github.com/Nukesor/comfy-table/issues/76

What do you think about writing a small section about your library as well? We could compile a full list lateron or link to each other's summaries in our README comparison sections.

I'm also quite happy to see comfy-table performing that well regarding speed :D. I did a few benchmarks myself, but never compared it to other libraries! You should probably give it a try with table.set_content_arrangement(ContentArrangement::Dynamic), which is one of its core features. This should probably perform a bit more poorly as there's quite a bit of calculation going on to find an optimal table layout in restricted spaces ;).

I would be happy to reference tabled in my README, I really like the way this project developed! It became quite fancy since the last time I looked :D

We could also try to maintain a setup of these benchmark and their results in your wiki if you like :) This should make it easier to link and update them.

zhiburt commented 2 years ago

I'm also quite happy to see comfy-table performing that well regarding speed :D

It took time to catch up withcomfy-table :)

PS: After some recent changes I think we got behind a bit (haven't checked).

You should probably give it a try with table.set_content_arrangement(ContentArrangement::Dynamic), which is one of its core features. This should probably perform a bit more poorly as there's quite a bit of calculation going on to find an optimal table layout in restricted spaces ;).

:+1:

The benchmarks were not 'using limited space'. But it could be tested in a new one.

I would be happy to reference tabled in my README, I really like the way this project developed! It became quite fancy since the last time I looked :D

As I previously said I also think its worth mention mentioning other libraries. Especially if they do something better or differently.

We could also try to maintain a setup of these benchmark and their results in your wiki if you like :) This should make it easier to link and update them.

:+1:

danieleades commented 2 years ago

i really like this effort. There's a lot of good work out there, and (speaking from experience) it's quite daunting trying to figure out which to use.

Nukesor commented 2 years ago

@zhiburt Once you wrote a short summary about your library, I'll add it to my README as well :) The author of cli-table already did so in their sibling ticket. Mine for comfy-table can be found over here.

zhiburt commented 2 years ago

Hi there, Sorry for the long response.

I'm planning to update docs in the nearest.

I think I'll shorten a bit your messages if you don't mind;

comfy-table

comfy-table focuses on providing a minimalistic, but rock-solid library for building text-based tables with focus on safety and dynamic-length content arrangement.

cli-table

cli-table tends to keep the compile time and crate size low and support all the platforms. It has an optional csv support.

term-table-rs

term-table-rs main focus is on a good set of tools for rendering CLI tables, while allowing users to bring their own tools for things like colors. One thing that is unique to term-table-rs is the ability to have different number of columns in each row of the table.

Let me know if there's any more libraries worth mentioning.

cc: @Nukesor @devashishdxt @RyanBluth

Nukesor commented 2 years ago

Perfect :)