I suppose the perfect gunpowder for any given gun barrel would have the following features: Every flake would be the exact same size as well as the exact same shape/geometry. Every flake would be the exact same density/weight and would be homogeneous in every aspect of the word. Each flake would ignite easily and predictably and would burn at the exact pre-determined rate and produce the exact same amount of gas and predictably increase the pressure inside the brass casing and cause the bullet to eventually exit the casing and engage the barrel of the gun at a pre-determined time/pressure. Each flake in the powder would chain ignite, burn, and be entirely be consumed in a predictable manner. Each flake would steadily contribute to the gases and pressures building inside the guns chamber/barrel. This chain reaction could be perfectly pre-measured and maximum velocity of the bullet could be pre-determined and repeatedly achieved. The maximum pressure/therefore the maximum velocity of the bullet inside the barrel would be achieved just at the exact instant the bullet exited the muzzle of the barrel. But the entire charge of powder would be mostly spent at this exact moment. Very little (if any) unburned gunpowder would be available to exit the barrel behind the bullet. The flash outside the gun barrel would be minimal.
#### In Short
The perfect gunpowder would produce high velocities, yet very little smoke, and minimal flash
#### But
This powder doesn't exist of course - but it would be certainly ideal.