From d4b45131cd18daaa5ef01e44a60be6b980e465cb Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 16 Jan 2020 10:54:22 +0300 Subject: [PATCH] Update alpine image, fixup for Makefile, fixup for benchmark --- Dockerfile | 4 ++-- Makefile | 17 ++++++++++++----- benchmark | 8 +++----- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 92b6036..7e6c0bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.11-alpine3.8 as builder +FROM golang:1-alpine as builder RUN set -x \ && apk add --no-cache \ @@ -28,7 +28,7 @@ RUN set -x \ && go build -mod=vendor -o /go/bin/homo ./cmd/homo/main.go # Executable image -FROM alpine:3.8 +FROM alpine:3.11 WORKDIR /fixtures diff --git a/Makefile b/Makefile index b5a6677..49acee5 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,8 @@ R=\033[0m NAME ?= homo -.PHONY: help attach auto up down +.PHONY: help attach auto up down deps + # Show this help prompt help: @echo ' Usage:' @@ -15,22 +16,28 @@ help: @echo '' @awk '/^#/{ comment = substr($$0,3) } comment && /^[a-zA-Z][a-zA-Z0-9_-]+ ?:/{ print " ", $$1, comment }' $(MAKEFILE_LIST) | column -t -s ':' | grep -v 'IGNORE' | sort | uniq +# Install dependencies +deps: + @go mod tidy -v + @go mod vendor + # Auto Tillich-Zémor hasher demo -auto: down +auto: down deps @echo "\n${B}${G}build container${R}\n" @time docker build -t poc-demo . @echo "\n${B}${G}Bootup container:${R}\n" @time docker run -d --rm -it --name hash-demo poc-demo:latest sh @bash ./auto.sh + @make down # Stop demo container down: @echo "\n${B}${G}Stop container${R}\n" - @docker stop hash-demo || true - @docker rm hash-demo || true + @docker kill hash-demo || true + @docker rm -f hash-demo || true # Run Tillich-Zémor hasher demo -up: down +up: down deps @echo "\n${B}${G}build container${R}\n" @time docker build -t poc-demo . @echo "\n${B}${G}enter inside container:${R}\n" diff --git a/benchmark b/benchmark index 93f446a..926c02a 100755 --- a/benchmark +++ b/benchmark @@ -1,13 +1,11 @@ #!/bin/bash -#tmpfile=$(mktemp /tmp/random-file.XXXXXX) -#size=$1 -#dd if=/dev/urandom of=$tmpfile bs=$size count=1 -tmpfile=$1 +tmpfile=$(mktemp /tmp/random-file.XXXXXX) +dd if=/dev/urandom of=$tmpfile bs=$1 count=1 go build ./cmd/tzsum && \ for impl in avx avx2 avx2inline purego; do echo $impl implementation: - /usr/bin/env time -f "time: %e seconds" ./tzsum -name $tmpfile -impl $impl + /usr/bin/env time ./tzsum -name $tmpfile -impl $impl echo done