Preheat the oven to 350 degrees F.
Coat a deep, 9-by-13-inch baking pan with the butter.
Place the bread cubes in a very large mixing bowl.
In a 10-inch saute pan, cook the bacon over medium heat until crisp.
Using a slotted spoon drain the bacon and add to the bread in the bowl.
Remove all but 2 tablespoons of the bacon fat from the pan, reserving the extra.
Add the onions to the pan and saute over medium-high heat, stirring frequently, until soft and lightly browned, about 3 minutes.
Sprinkle the sugar over the onions and saute, stirring constantly, until the onions turn golden and the edges caramelize, about 3 to 5 minutes.
Add to the bread in the bowl.
Return the pan to medium heat, add 2 tablespoons of the reserved bacon fat and swirl to coat the pan.
Add the pears and celery and saute, stirring frequently, until softened, about 4 to 5 minutes.
Add pecans, rosemary, parsley, thyme, sage, salt, and pepper to taste, and saute 1 minute longer.
Add this mixture to the bread cubes, and stir to combine.
Add the beaten eggs and stock to the bowl, and mix well.
Place the stuffing in the prepared pan and bake, uncovered, until the top is lightly browned and crusty, about 1 hour.