Skip to main content

Posts

Showing posts with the label bash

How can I get `find` to ignore .svn directories?

I often use the find command to search through source code, delete files, whatever. Annoyingly, because Subversion stores duplicates of each file in its .svn/text-base/ directories my simple searches end up getting lots of duplicate results. For example, I want to recursively search for uint in multiple messages.h and messages.cpp files:

PHP is slower than it should be

Originally, I posted this on ServerFault ... but perhaps it is more of a PHP lingual question. I have a server with Dual Xeon Quad Core L5420 running at 2.5GHz. I've been optimizing my server, and have come to my final bottleneck: PHP. My very simple PHP script: ./test.php <?php print_r(posix_getpwuid(posix_getuid())); My not-so-scientific-because-they-don't-pay-attention-to-thread-locking-but-scientific-enough-to-give-me-a-reasonable-multithreaded-requests-per-second-result scripts: ./benchmark-php #!/bin/bash if [ -z $1 ]; then LIMIT=10 else LIMIT=$1 fi if [ -z $2 ]; then SCRIPT="index.php" else SCRIPT=$2 fi START=$(date +%s.%N) COUNT=0 while (( $COUNT < $LIMIT )) do php $SCRIPT > /dev/null COUNT=$(echo "$COUNT + 1" | bc) done END=$(date +%s.%N) DIFF=$(echo "$END - $START" | bc) REQS_PER_SEC=$(echo "scale=2; $COUNT / $DIFF" | bc) echo $REQS_PER_SEC ./really-benchmark-php #!/bin/bash if [ -z $1 ]; then