April 16, 2026
10:01 p.m.
When a For-Each loop iterates over a SAFEARRAY, bypass the IEnumVARIANT COM vtable dispatch and copy elements directly from the array data. This eliminates the COM call overhead and one intermediate VariantCopy per iteration. For non-refcounted element types (VT_I2, VT_I4, VT_R8, etc.), also skip VariantCopyInd and VariantClear entirely, replacing them with a direct struct assignment. Non-SAFEARRAY iterators (e.g. IDispatch collections) continue to use the standard IEnumVARIANT_Next path. For-Each over a 10M-element integer array: 6,339ms -> 58ms (109x faster). -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10685