ctongfei / progressbar

Terminal-based progress bar for Java / JVM
http://tongfei.me/progressbar/
MIT License
1.08k stars 103 forks source link

Improve performance in ConsoleProgressBarConsumer.accept #106

Closed heroesleo65 closed 3 years ago

heroesleo65 commented 3 years ago

StringDisplayUtils.trimDisplayLength(str, max_display_len) to select string with minimal of total display length this str and given max_display_len. I mean that calculate display length of string is unnecessary. This idea is using in InteractiveConsoleProgressBarConsumer (https://github.com/ctongfei/progressbar/blob/4f86bc3b7d71071fac7a03dd05d7d00a092779cf/src/main/java/me/tongfei/progressbar/InteractiveConsoleProgressBarConsumer.java#L27)

ctongfei commented 3 years ago

Yeah you are right. The code is completely redundant. Thanks!