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

Avoid unnecessary analysis #154

Closed
borkdude opened this issue Nov 16, 2019 · 2 comments
Closed

Avoid unnecessary analysis #154

borkdude opened this issue Nov 16, 2019 · 2 comments

Comments

@borkdude
Copy link
Collaborator

In Clojure only expressions in top-level dos are compilations units. Currently we handle all expression in every do as separate analysis-interpretation units. Double check if we are not doing any double work here when a macro emits a do expression (e.g. analyze all body expressions, emit (do ....) which then gets analyzed again later).

@borkdude
Copy link
Collaborator Author

Identified unnecessary analysis when for example executing functions or loops:

(loop [x 1] (if (< x 2) (recur (inc x)) (+ x 1 2 3)))

The if expression is analysed on every loop execution. This should be improved.

@borkdude
Copy link
Collaborator Author

borkdude commented Nov 17, 2019

Before: Execution time mean : 337,902443 µs
After: Execution time mean : 115,640785 µs

borkdude added a commit that referenced this issue Nov 17, 2019
This commit improves performance:

```
SCI_TEST_PERFORMANCE=true lein test :only sci.performance
```

Before:
Execution time mean: 337,902443 µs

After:
Execution time mean: 115,640785 µs
@borkdude borkdude changed the title Double-check unnecessary analysis roundtrips Avoid unnecessary analysis Nov 17, 2019
borkdude added a commit to babashka/babashka that referenced this issue Nov 17, 2019
borkdude added a commit to babashka/babashka that referenced this issue Nov 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant