8000 Feature/add benchmarks [in progress] by adamhaber · Pull Request #385 · sicmutils/sicmutils · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Feature/add benchmarks [in progre 8000 ss] #385

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

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

adamhaber
Copy link
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
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?

@@ -10,4 +10,5 @@
org.clojure/core.match {:mvn/version "1.0.0"},
cljsjs/complex {:mvn/version "2.0.11-0"},
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"}}}
Copy link
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
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?


(defn forward-pass [ws-layers]
(fn [input]
(vec (flatten (map #(reducers/reduce sum-layer % ws-layers) input)))))
Copy link
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
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 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.

2 participants
0