Many modern interactions happen in a digital space, where automated recommendations and homophily can shape the composition of groups interacting together and the knowledge that groups are able to tap into when operating online. Digital interactions are also characterized by different scales, from small interest groups to large online communities. Here, we manipulate the composition of groups based on a large multi-trait profiling space (including demographic, professional, psychological and relational variables) to explore the causal link between group composition and performance as a function of group size. We asked volunteers to search news online under time pressure and measured individual and group performance in forecasting real geo-political events. Our manipulation affected the correlation of forecasts made by people after online searches. Group composition interacted with group size so that composite diversity benefited individual and group performance proportionally to group size. Aggregating opinions of modular crowds composed of small independent groups achieved better forecasts than aggregating a similar number of forecasts from non-modular ones. Finally, we show differences existing among groups in terms of disagreement, speed of convergence to consensus forecasts and within-group variability in performance. The present work sheds light on the mechanisms underlying effective online information gathering in digital environments.