wpd($document);
	     if (is_object($solr)) {
	     	try {
	       $solr -> addDocument($document);
	       $solr -> commit();
	       $solr -> optimize(FALSE, FALSE);	     		
	     	}

Don't commit and optimize on every document. See what we did here: http://drupal.org/node/292662