In this article, we discuss an optimization approach to the sample size question, founded on maximizing the value of information in comparison studies with binary responses. The expected value of perfect information (EVPI) is calculated and the optimal sample size is obtained by maximizing the expected net gain of sampling (ENGS), the difference between the expected value of sample information (EVSI) and the cost of conducting the trial. The data are assumed to come from two independent binomial distributions, while the parameter of interest is the difference between the two success probabilities, [Formula: see text]. To formulate our prior knowledge on the parameters, a Dirichlet prior is used. Monte Carlo integration is used in the computation and optimization of ENGS. We also compare the results of this approach with existing Bayesian methods and show how the new approach reduces the computational complexity considerably.