massimo-zaniboni / aoc-benchmarks Goto Github PK
View Code? Open in Web Editor NEWPublish some Advent of Code benchmarks
Home Page: https://aoc-benchmarks.dokmelody.org/
Publish some Advent of Code benchmarks
Home Page: https://aoc-benchmarks.dokmelody.org/
Prova per vedere che funzioni tutto
main = main2
main1 = sol1 <$> input >>= print
main2 = sol2 <$> input >>= print
input :: IO [Int]
input = read . ('[':) . (++"]") <$> getContents
cost :: (Int -> Int) -> [Int] -> Int
cost d ps = sum $ map d ps
median :: [Int] -> Int
median ps = last . take (quot (length ps) 2) $ L.sort ps
mean :: [Int] -> Int
mean ps = quot (sum ps) (length ps)
-- sol1 <$> input 344138
-- sol2 <$> input 94862124
sol1, sol2 :: [Int] -> Int
sol1 ps = cost (abs . subtract (median ps)) ps
sol2 ps = cost (\p -> sum [1..(abs $ (mean ps - p))]) ps
Legge da stdin
SBCL librariers must be loaded during the installation of the image.
The name of the benchmark links sometime to the list of programs solving the problem, but in other cases to the source code.
There is a list of programs done in the same language, but it is not clear to select.
The link on a fail should jump to the section with the benchmark failing.
Use some test as baseline, and repeat it before updating other benchmarks and between benchmarks, for double checking that the speed of the server is constant.
If I execute the tests manually, the Lisp code is fast and terminate. But with the bencher the program fail.
I tested also on a bare metal Ubuntu. So the problem is not only inside Docker.
This is the link to all the solutions I wrote for this year in Clojure: jabberabbe/advent-of-code. Every problem is split into two separate independent files (part A and part B).
Each script takes the program input on stdin and writes the solution to stdout.
Some notes:
clj -M [clojure_file_containing_solution] < [input_file]
. Keep the file deps.edn
in the same directory of the scripts and run clj
from that directory.bb -f [clojure_file_containing_solution] < [input_file]
.Thank you!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.