Boy Scouts of America

As a child, my parents didn’t allow me to join the Boy Scouts of America in protest of their discriminatory policies towards gays. As an adult, I’m glad they didn’t.

It’s very inspiring to see this (not gay) Eagle Scout’s letter as he returns his Eagle Scout badge because he “cannot in good conscience hold this badge as long as the BSA continues a policy of bigotry”.

Even more inspiring to see the measured & mature method in which he goes about it.

Today I learned that creating getters & setters in PHP more than doubles execution time.

From reddit, I found this command-line snippet:¬†http://pastie.org/638732. It reminded me that in general I want to do more of these kinds of tests. It’s bound to lead to interesting discoveries.

Any ideas what I should test myself?

 

> php -d implicit_flush=off -r  '\
  class dog {\
    public $name = "";\
    public function setName($name) { $this->name = $name; }\
    public function getName() {return $this->name; }\
  }\
  $rover = new dog();\
  for ($x=0; $x<10; $x++) {\ 
    $t = microtime(true);\
    for ($i=0; $i<1000000; $i++) { \
      $rover->setName("rover");\
      $n = $rover->getName();\
    }\
  echo microtime(true) - $t;\
  echo "\n";}'
1.48462200165
1.49136686325
1.48365998268
1.47310495377
1.46616101265
1.44583415985
1.42663908005
1.43124985695
1.42830300331
1.42891597748

> php -d implicit_flush=off -r  '\
  class dog { \
    public $name = "";\
  }\
  $rover = new dog();\
  for ($x=0; $x<10; $x++) {\
    $t = microtime(true); \
    for ($i=0; $i<1000000; $i++) { \
      $rover->name = "rover"; \
      $n = $rover->name;\
    }\
  echo microtime(true) - $t;\
  echo "\n";\
}'
0.700392007828
0.686674118042
0.687913894653
0.693347930908
0.697072982788
0.708423852921
0.709672927856
0.704964876175
0.704661130905
0.708118915558