Skip to content
This repository was archived by the owner on Jun 18, 2025. It is now read-only.

Feature/add benchmarks [in progress]#385

Draft
adamhaber wants to merge 7 commits into
sicmutils:mainfrom
adamhaber:feature/add-benchmarks
Draft

Feature/add benchmarks [in progress]#385
adamhaber wants to merge 7 commits into
sicmutils:mainfrom
adamhaber:feature/add-benchmarks

Conversation

@adamhaber
Copy link
Copy Markdown
Contributor

An initial attempt at addressing https://github.com/sicmutils/placeholder/issues/86 .

Currently dumps everything in a single file in a benchmarks folder. Eventually, we might want to consider doing something like Stan does where benchmarks are run on every PR (via Jenkins) and generate a report on the PR itself; this makes it easy to see the performance implications of the suggested change, which is nice.

This is WIP, would be happy to get feedback on what would be a good next step, here.

@adamhaber adamhaber changed the title Feature/add benchmarks Feature/add benchmarks [in progress] Nov 7, 2021
@sritchie
Copy link
Copy Markdown
Member

sritchie commented Nov 8, 2021

Nice! The first thing that would be great here would be a short paragraph for each of these about what it is testing, what is actually happening. Next thing is at least a text description in the namespace that describes how to run the benchmarks.

Is there some manual timing report generated that we can copy in to the namespace, commented out?

Comment thread deps.edn
borkdude/sci {:mvn/version "0.2.5"},
cljsjs/bigfraction {:mvn/version "4.1.1-0"}}}
cljsjs/bigfraction {:mvn/version "4.1.1-0"}
criterium/criterium {:mvn/version "0.4.4"}}} No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Adding this here will make criterium a dependency of the whole project, which we don't want. Can you add a separate build target that adds this to dependencies? There should be some model out there, though I don't have my head around deps.edn style yet. But imagine that this is the same problem as a testing target, where you don't want to ship the testing framework out to folks that are consuming the library.

Copy link
Copy Markdown
Contributor Author

@adamhaber adamhaber Nov 8, 2021

Choose a reason for hiding this comment

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

If I understand this guide correctly, we should be able to do something like this in deps.edn,

;; deps.edn
{:paths   ["src"]
 :deps    ...whichever deps we have right now...
 :aliases {:test    {:extra-paths ["test"]
                     :extra-deps  ...tests-specific deps...}
           :benchmark {:extra-paths ["benchmark"]
                     :extra-deps {criterium/criterium {:mvn/version "0.4.4"}}
                    }}}

right?

Comment thread benchmarks/benchmakrs.clj Outdated
Comment thread benchmarks/benchmakrs.clj Outdated

(defn forward-pass [ws-layers]
(fn [input]
(vec (flatten (map #(reducers/reduce sum-layer % ws-layers) input)))))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I need to stare at this for a bit before I can comment well, but flatten is almost never needed - flatten flattens arbitrary layers of nesting, and it is usually cleaner to flatten just the layers that you want, using perhaps mapcat or apply concat.

Sorry about my lazy code formatting, I'm trying to get used to an ergo keyboard to save my pinkies and code is REALLY tough to type!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Tried to remove these, still not sure I am doing this optimally, any feedback would be much appreciated :-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants