Closed t-mat closed 10 years ago
I am thinking of automating the running benchmark business using something like Jenkins. Since we will never be running two of these benchmarks together on the same node, having one single name (which can be captured as artifact, to visually verify the run) will make:
What do you think?
I prefer to specify output filename :
go run main.go -mp=4 -output=gorays-4mpix.ppm
"render.ppm" as default filename is okay. But hard coded / completely fixed output filename seems too much strict.
I wanted to use the "flag" library in Go. But is such a possibility equally trivial in other languages/frameworks?
Then I agree, we should keep it flexible
First of all, I'm sorry for bad PR. I should have implemented same function and create another issue about fixed filename.
But is such a possibility equally trivial in other languages/frameworks?
No, maybe. Many languages have getopt
or something like that. But it is not a part of standard for some languages (eg:C/C++/Java).
We want to achieve
So I think it is a good time to introduce small glue scripts which receive same argument but run target scripts/executables with different command-line fashion.
example1: run-goray.sh
#!/bin/sh
MEGAPIXELS=$1
ITERATION=$2
THREADS=$3
OUTPUTFILE=$4
LOGFILE=$5
go run ./gorays/main.go -mp=$MEGAPIXELS -times=$ITERATION -procs=$THREADS -output=$OUTPUTFILE > $LOGFILE
example2: run-cppray.sh
#!/bin/sh
MEGAPIXELS=$1
ITERATION=$2
THREADS=$3
OUTPUT=$4
LOGFILE=$5
./bin/cpprays $MEGAPIXELS $ITERATION $THREADS 1> $OUTPUT 2> $LOGFILE
Hey, nvm :)
I will merge this in now. I like the idea of wrapper scripts. Lets explore that
Why check for < 0.0f?
I just implemented standard way for clamping to avoid too early optimization. But it was too naive for such a frequently called function.
Would a min(x, 255) be better?
Yes. Your are right.
There are trivial changes. Basically aim to the same result as Go's.
Note: I didn't implement fixed output to 'render.ppm'. I think filename fixing is not a good idea. Because it is not convenient for running multiple languages from same directory.