Commit 2ac4c961 authored by nimrod's avatar nimrod
Browse files

Updates.

Changes I had laying around but didn't commit. The README should be
readable now.
parent e3a36bc1
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -2,3 +2,5 @@ a.out
*.pyc
*.pyc
__pycache__/*
__pycache__/*
*.swp
*.swp
prime
go
+9 −2
Original line number Original line Diff line number Diff line
@@ -3,7 +3,11 @@ ENV LEIN_VERSION=2.5.3
ENV LEIN_ROOT=value
ENV LEIN_ROOT=value
WORKDIR /tmp
WORKDIR /tmp
RUN apt-get update && \
RUN apt-get update && \
    apt-get install -y python \
    apt-get install -y python-dev \
                       python-pip \
                       build-essential \
                       llvm3.7-dev \
                       python-numpy \
                       python3 \
                       python3 \
                       pypy \
                       pypy \
                       lua5.1 \
                       lua5.1 \
@@ -18,8 +22,10 @@ RUN apt-get update && \
                       clojure1.6 \
                       clojure1.6 \
                       tcl \
                       tcl \
                       time \
                       time \
                       golang \
                       wget && \
                       wget && \
    mkdir /tmp/leiningen && \
    mkdir /tmp/leiningen && \
    pip install numba && \
    wget --quiet https://github.com/technomancy/leiningen/archive/$LEIN_VERSION.tar.gz -O - | \
    wget --quiet https://github.com/technomancy/leiningen/archive/$LEIN_VERSION.tar.gz -O - | \
    tar -xz -C /tmp/leiningen/ --strip-components=1 && \
    tar -xz -C /tmp/leiningen/ --strip-components=1 && \
    mv /tmp/leiningen/bin/lein-pkg /usr/local/bin/lein && \
    mv /tmp/leiningen/bin/lein-pkg /usr/local/bin/lein && \
@@ -27,7 +33,8 @@ RUN apt-get update && \
    wget --quiet \
    wget --quiet \
        https://github.com/technomancy/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.zip \
        https://github.com/technomancy/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.zip \
        -O /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \
        -O /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \
    rm -rf rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
    apt-get clean && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY ./ /benchmark
COPY ./ /benchmark
WORKDIR /benchmark
WORKDIR /benchmark
RUN make
RUN make
+0 −0

File moved.

+11 −4
Original line number Original line Diff line number Diff line
.PHONY: all test clean c clojure
.PHONY: all test clean c clojure
ROUNDS = 100000
ROUNDS ?= 100000


all: c clojure
.PHONY: all
all: c clojure go


.PHONY: c
c: a.out
c: a.out


.PHONY: clojure
clojure: target/uberjar
clojure: target/uberjar


target/uberjar:
target/uberjar:
@@ -13,10 +16,14 @@ target/uberjar:
a.out:
a.out:
	gcc --std=c99 -Wall -lm -O3 prime.c
	gcc --std=c99 -Wall -lm -O3 prime.c


.PHONY: clean
clean:
clean:
	- rm -fr a.out __pycache__
	git clean -fdX
	cd prime.clj; lein clean


go: prime.go
	go build -o go prime.go

.PHONY: all
test: all
test: all
	@ time -f "%C : %E seconds" ./a.out $(ROUNDS) > /dev/null
	@ time -f "%C : %E seconds" ./a.out $(ROUNDS) > /dev/null
	@ time -f "%C : %E seconds" java -jar prime.clj/target/uberjar/*-standalone.jar $(ROUNDS) > /dev/null
	@ time -f "%C : %E seconds" java -jar prime.clj/target/uberjar/*-standalone.jar $(ROUNDS) > /dev/null
+11 −2
Original line number Original line Diff line number Diff line
@@ -21,22 +21,25 @@ Added languages
Usage
Usage
-----
-----
Build:
Build:

.. code:: shell
.. code:: shell


    make
    make


Clean:
Clean:

.. code:: shell
.. code:: shell


    make clean
    make clean


Test:
Test:

.. code:: shell
.. code:: shell


    make test
    make test


Also, Docker and Docker Compose are supported (so just run :code:
Also, Docker and Docker Compose are supported (so just run
`docker-compose up`).
:code:`docker-compose up`).


History
History
-------
-------
@@ -46,3 +49,9 @@ structure. But I had difficulties expressing what I wanted so I first wrote the
program in Python. After I had the program written in both languages I did the
program in Python. After I had the program written in both languages I did the
obvious thing, I timed them. From there on Barak implemented the program in PHP
obvious thing, I timed them. From there on Barak implemented the program in PHP
and we implemented it in C. We hope to have many more languages tested.
and we implemented it in C. We hope to have many more languages tested.

License
-------

This software is licensed under the BSD 3-clause license (see the
:code:`LICENSE.txt` file).
Loading