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

Faster promesa.exec/wrap-bindings #156

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Nov 18, 2024

  1. Faster promesa.exec/wrap-bindings

    83x faster than current implementation 
    ```
    (run-benchmark
      (fn []
        (testing "`promesa.exec.csp` implementation"
          ;; 4.956172 µs — this is due to `promesa.exec/wrap-bindings`'s way of forwarding
          ;; bindings, which is 83x slower than `clojure.core/binding-conveyor-fn`
          (criterium/bench
            (csp/go))
          ;; 4.889489 ms
          (criterium/bench
            (dotimes [i 1000]
              (csp/go))))
        (testing "Bare implementation"
          ;; 59.033042 ns
          (criterium/bench
            (-> (Thread/ofVirtual)
                (.unstarted (fn []))
                (.start))))
        (testing "With bindings forwarding"
          ;; 58.851215 ns
          (criterium/bench
            (-> (Thread/ofVirtual)
                (.unstarted (binding-conveyor (^{:once true} fn* [] ~@Body)))
                (.start))))))
    ```
    alexandergunnarson authored Nov 18, 2024
    Configuration menu
    Copy the full SHA
    c099142 View commit details
    Browse the repository at this point in the history
  2. Use :once true in fns used in wrap-bindings

    This is what `clojure.core/future` does.
    alexandergunnarson authored Nov 18, 2024
    Configuration menu
    Copy the full SHA
    05d73b4 View commit details
    Browse the repository at this point in the history