Fix a performance regression for Windows platform