Abstract As a connection to the outdoor environment, windows can relieve the stress, emotional, and cognitive fatigue that building users face from long hours of study. It provides restorative function for building users between study and work, thus reducing task load and improving learning performance. To investigate the effects of different window:wall ratios (WWRs) on task load and learning performance, virtual reality (VR) technology was used to build virtual classrooms with WWRs of 25%, 40%, 55%, 70%, and 85%. The task performances, physiological data, and subjective evaluations of 34 college studies were analyzed. It was found that the highest subjective psychological loads were in classrooms with a 25% WWR and were lowest when the WWR was 55%. Participants performed best in classrooms with a WWR of 55%. Further multiobjective optimization with particle swarm optimization found that 58.41–62.24% WWR not only contributed to the users’ physical and mental happiness but also improved their learning efficiency. In addition, the participant’s HRV-LF/HF and EEG β wave values were significantly correlated with their performance on the task test. These findings provide a reference for the spatial design of school classrooms and a foundation for further research into the relationship between HRV and EEG physiological indicators and learning efficiency.