Commit 05f5f59
authored
perf: faster utf8<->utf16 conversion on Windows (#4549)
OIIO 2.3.13 with PR #3307 changed
MultiByteToWideChar/WideCharToMultiByte usage to C++11 <codecvt>
functionality, but that has two issues:
1) it is *way* slower, primarily due to locale object access (on Visual
C++ STL implementation in VS2022 at least). Since primary use case of
these conversions is on Windows, maybe it is better to use a fast code
path.
2) whole of <codecvt> machinery is deprecated with C++17 accross the
board, and will be removed in C++26. I've kept the existing functions in
there since otherwise it would have been an API break, but really maybe
with OIIO 3.0 they should have been un-exposed. Too late now though :(
## Tests
Performance numbers: doing ImageInput::create() on 1138 files where they
are not images at all (so OIIO in turns tries all the input plugins on
them). Ryzen 5950X, VS2022, Windows:
- utf8_to_utf16 3851ms -> 21ms
- utf16_to_utf8 1055ms -> 4ms
Signed-off-by: Aras Pranckevicius <[email protected]>1 parent da475b0 commit 05f5f59
1 file changed
+36
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| |||
961 | 964 | | |
962 | 965 | | |
963 | 966 | | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
964 | 978 | | |
965 | 979 | | |
966 | 980 | | |
| |||
970 | 984 | | |
971 | 985 | | |
972 | 986 | | |
| 987 | + | |
973 | 988 | | |
974 | 989 | | |
975 | 990 | | |
976 | 991 | | |
977 | 992 | | |
978 | 993 | | |
979 | 994 | | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
980 | 1006 | | |
981 | 1007 | | |
982 | 1008 | | |
| |||
986 | 1012 | | |
987 | 1013 | | |
988 | 1014 | | |
| 1015 | + | |
989 | 1016 | | |
990 | 1017 | | |
991 | 1018 | | |
992 | 1019 | | |
993 | 1020 | | |
994 | 1021 | | |
995 | 1022 | | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
996 | 1031 | | |
997 | 1032 | | |
998 | 1033 | | |
999 | | - | |
1000 | | - | |
1001 | | - | |
1002 | | - | |
1003 | | - | |
1004 | | - | |
1005 | 1034 | | |
1006 | 1035 | | |
1007 | | - | |
1008 | 1036 | | |
1009 | 1037 | | |
1010 | 1038 | | |
1011 | 1039 | | |
| 1040 | + | |
1012 | 1041 | | |
1013 | 1042 | | |
1014 | 1043 | | |
| |||
0 commit comments