lilydjwg / swapview-rosetta

Print swap usage per process. Implemented in various programming languages
491 stars 108 forks source link

Some improvements for the CHICKEN version #95

Closed sjamaan closed 9 years ago

sjamaan commented 9 years ago

The CHICKEN version was not very idiomatic, overly long, and used a few slow constructs. These commits improve readability and maintainability, hopefully. They should also make it a little bit faster, without making it less maintainable.

Currently, the biggest bottleneck seems to be the format egg. Improving that would be pretty tricky, I think.

xieyuheng commented 9 years ago

@sjamaan thank you ^-^

lilydjwg commented 9 years ago

Thanks very much!

sjamaan commented 9 years ago

@xieyuheng Thanks for bringing this code to my attention.

@lilydjwg Thanks for writing the initial version and accepting my pull request.

I wonder how we can improve this code. I guess I'd have to dive into the format egg's implementation, but I'd rather avoid pulling in an egg. Maybe core needs better formatting support, but I don't like the idea of complicating the sprintf procedure, either...

lilydjwg commented 9 years ago

Oh, it's @farseerfc who wrote the initial version, not me.

A language has to provide advanced formatting support. If not builtin, there will be an external library doing that. You can see that if you take a look of other languages here. I don't know Chicken well, but I expect it provide this kind features via a "standard library" that most installations will include by default.