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

Move away from destructuring query terms, and create separate arities for terms which include optargs #101

Open
danielcompton opened this issue Oct 12, 2015 · 0 comments

Comments

@danielcompton
Copy link
Collaborator

I'm not sure how important or necessary this is, but there is a fairly large performance hit for destructuring optional arguments in functions.

For example:

(defn changes
  "Return an infinite stream of objects representing changes to a query."
  [xs & [optargs]]
  (term :CHANGES [xs]))

takes roughly 200 ns to run when passed an optarg, whereas

(defn changes
  "Return an infinite stream of objects representing changes to a query."
  ([xs]
   (term :CHANGES [xs] nil))
  ([xs optargs]
    (term :CHANGES [xs] optargs)))

takes ~25 ns. While the speedup is large in relative terms, it's still fairly small in absolute terms.

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

1 participant