Skip to content

Conversation

@gdw2
Copy link

@gdw2 gdw2 commented Nov 26, 2024

Very much a WIP

It was simple to remove (assuming it works) and ring buffer isn't
compatible with nbb.
needed for nbb
Copy link
Member

@jpmonettas jpmonettas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a couple of comments regarding removing ring-buffer.
Apart from that, what I'm not sure is about how instrumentation would work for nbb since if I understand correctly it doesn't use Clojure or ClojureScript for compilation, it uses SCI to interpret Clojure right?


(defn clear-outputs []
(reset! *last-evals-results (ring-buffer 10))
(reset! *last-evals-results [])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I added a ring-buffer here is because the ring-buffer library was already here for other functionality (see my comment below) and I think it looks cleaner


[coll A B pred]
(loop [elems-before (ring-buffer A)
(loop [elems-before []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I brought a ring-buffer for this only for performance reasons. If we change it like the proposed time will grow linearly on A, making it too slow for the current case.

On my box :

(def col (doall (repeat 10000000 :elem)))

(time (grep-coll                     col 1000 1 (constantly false))) ; ~ 1 sec
(time (grep-coll-without-ring-buffer col 1000 1 (constantly false))) ; ~ 207 sec

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

Successfully merging this pull request may close these issues.

3 participants