GithubHelp home page GithubHelp logo

progress's Introduction

Hi there ๐Ÿ‘‹

progress's People

Contributors

askn avatar destynova avatar hinrik avatar ilmanzo avatar sdogruyol avatar slayershadow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

progress's Issues

Is the project maintained?

Hello,

I've checked your project and it's failing to build (or the specs failed) with the latest Crystal (0.26.1) or there are no any specs so the project cannot be validated to be up to date. Your project is in Awesome Crystal list, so I'd like to ask if the project maintained?

I'll initiate a PR to remove your project from the list if you don't respond positively within 7 days.

I'm sorry if I'm wrong, because I've been checking many shards with automated script.

Thanks,
Vlad.

Private method #print

Is it correct that #print is defined as private? Does deny to print the bar manually depend on some reason or it was by design?

Currently progress bar is using including some statistics written to stdout. Something like this:

2018-12-20 21:26:18 UTC       Generation: 8884        Iterations: 150654
2018-12-20 21:34:26 UTC       Generation: 8922        Iterations: 152000
2018-12-20 23:28:48 UTC       Generation: 8940        Iterations: 165670
2018-12-20 23:39:51 UTC       Generation: 8999        Iterations: 188872
[โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘]  45.34 %

Because of definition (which is correct):
print(new_percent) if new_percent != old_percent
there is no progress bar shown until a hundredth of a percent will be changed.

There can be used previous_def to override original behaviour:

class ProgressBar
  def print( value = percent ) : Void
    previous_def
  end
end

bar.print

some_loop do
  run_heavy_logic

  if statistics_changed?
    print_some_statistics
    bar.print
  end

  bar.inc
end

But it is not so beautiful.

Progress bar graphics bugs

Summary

"total" greater than 19999 will trigger a graphics bugs.

Problem Code

  • 10000
require "progress"

bar = ProgressBar.new
bar.total = 10000
bar.width = 40

10000.times { |ln| bar.inc; sleep(0.001) }
puts "overflow"
  • 50000
require "progress"

bar = ProgressBar.new
bar.total = 50000
bar.width = 40

50000.times { |ln| bar.inc; sleep(0.001) }
puts "overflow"

Screenshot

i

Bar excedes screen

It seems that when bar size is very large (6k) the bar is just starching over half the terminal.
Is there a way to have a constant max size for the bar ? even if you want more "members" in it ?

Memory leak with high number of ticks

I tried this shard in a project that worked through about 11 million rows.

I set bar.total to the number of rows and at about 50% memory usage had grown to about 30 GB.

After removing the progress bar in replacing it with a print statement the memory usage dropped 15 MB.

crystal --version
Crystal 0.35.1 (2020-06-19)

LLVM: 10.0.0
Default target: x86_64-apple-macosx

Similar code ("do stuff" sends line to a channel):

require "progress"

File.open("data.txt", "r") do |f|
  lines = 0
  f.each_line { lines += 1 }
  f.rewind
  bar = ProgressBar.new
  bar.total = lines
  f.each_line.with_index do |line, index|
    # do stuff
    bar.inc
  end
  bar.done
end

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.