str-wstr func: improve performace