Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallelization #8

Open
eapache opened this issue Jan 12, 2014 · 2 comments
Open

Parallelization #8

eapache opened this issue Jan 12, 2014 · 2 comments
Milestone

Comments

@eapache
Copy link
Owner

eapache commented Jan 12, 2014

Perhaps via https://github.com/grosser/parallel or some other gem.

Parsing files (in particular large Ruby files) is slow, so parallelizing it would be a big speed-up on multi-core systems.

@bry-guy
Copy link

bry-guy commented Sep 11, 2020

I gave this a try over the past few days, utilizing Parallel.each for parsing the AST, such as:

    def add_files(files)
      Parallel.each do |file|
        @output.extra("Adding `#{file}`")
        parse_file(file)
      end
    end

Unfortunately, since parsing the AST depends upon db's @table and @meta instance variables, putting the parsing into threads via parallel meant that those instance variables were not shared across threading contexts. Unwinding this is probably possible, but wasn't dead-simple. I think using https://github.com/ruby-concurrency/concurrent-ruby may require less surgery within starscope.

@eapache
Copy link
Owner Author

eapache commented Sep 11, 2020

Yeah, that's possible.

In practice I've found, for very large ruby projects, #95 and #154 dominate as performance issues anyway. If I had the time to do performance surgery, that's where I'd start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants