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

Performance #344

Closed
ArneBachmann opened this issue Oct 22, 2017 · 11 comments
Closed

Performance #344

ArneBachmann opened this issue Oct 22, 2017 · 11 comments

Comments

@ArneBachmann
Copy link
Contributor

Sorry for not being very constructive, but the Coconut compiler|s performance is somewhat abysmal.
For a 500 LOC tool it takes about 10 seconds on my Linux laptop, and 15s on my 4 years old Windows PC.
This is simply too slow for the typical Python REPL testing/prototyping workflow.

Any ideas on how to improve on speed?

@evhub
Copy link
Owner

evhub commented Oct 23, 2017

@ArneBachmann See the FAQ entry on how do I achieve maximum performance. If you just use cPyparsing or PyPy, you can get a lot of the way towards significantly improved performance.

In the long run, #299 is my current best bet for how to improve base performance, though it'll be a big undertaking.

@ArneBachmann
Copy link
Contributor Author

I'm reaching 15s per compile for 900 LOC. It becomes harder and harder to test and debug. Splitting the code into many different files is no option either, due to #320

@evhub
Copy link
Owner

evhub commented Nov 3, 2017

@ArneBachmann Yeah, I'll definitely prioritize trying to get some work done on this front as soon as I get a chance, and #320 is on my short list of things to do before the next release.

@evhub
Copy link
Owner

evhub commented Nov 27, 2017

@ArneBachmann Try cloning and installing the new computation-graph branch and see if it helps with your performance issues! If you do, definitely comment on the computation graph pull request and let me know how it worked out for you.

@ArneBachmann
Copy link
Contributor Author

ArneBachmann commented Nov 27, 2017

Hint: to update to a development branch, you need to
sudo pip[3] uninstall coconut (several times to remove all old versions)
Clone the repository:

git clone https://github.com/evhub/coconut.git
git pull origin computation-graph
sudo python3 setup.py clean build install

Replace calls to coconut by coconut-develop (and -run).

In my case this leads to:

Traceback (most recent call last):
  File "/usr/bin/coconut-develop", line 9, in <module>
    load_entry_point('coconut-develop==1.3.1.post0.dev8', 'console_scripts', 'coconut-develop')()
  File "/usr/lib/python3.4/site-packages/pkg_resources/__init__.py", line 558, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3.4/site-packages/pkg_resources/__init__.py", line 2681, in load_entry_point
    raise ImportError("Entry point %r not found" % ((group, name),))
ImportError: Entry point ('console_scripts', 'coconut-develop') not found

@ArneBachmann
Copy link
Contributor Author

Any hint on how to install the developer version? Is there a guide in the official docs somewhere?

@evhub
Copy link
Owner

evhub commented Nov 29, 2017

@ArneBachmann Coconut doesn't support installation via setup.py--you must use pip. Try make wipe to remove previous versions of Coconut, then make install to install the version you just cloned.

@ArneBachmann
Copy link
Contributor Author

Just tried installing that on the train at 200km/h downloading all kinds of dependencies that the mainline coconut doesn't require, and saw that it was actually installing into Python 2, while I used to install coconut always into Python 3. Anyway it somehow worked, but I couldn't detect any speed improvements so far. It takes 30 seconds to compile a 1000 lines coconut file. I'll keep you posted.

@evhub
Copy link
Owner

evhub commented Nov 30, 2017

@ArneBachmann Thanks for trying it out! If you want to install it locally on Python 3, try pip3 install -e . (or python3 -m pip install -e .). By default, make install just installs into whatever the default python is, 2 or 3.

@ArneBachmann
Copy link
Contributor Author

That did the trick. I'm not entirely sure, but coconut feels even slower now :-( it was 10s before, and is 20-30s now I think. Should I try pypy instead? Had good experience with in in the past.

@ArneBachmann
Copy link
Contributor Author

Ah, seems like --strict make compilation much slower. Need to test again without.

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