Not a groundbreaking speedup, and it does make the code larger which is why I left it out of #35, but this makes the following relatively small changes:
replaces the use of CreateFileA with CreateFileW. The Unicode (UTF-16) WinAPI is the actual native one on Windows, and CreateFileA probably ends up calling MultiByteToWideChar and CreateFileW itself at some point. By storing the wide-char (UTF-16) version of options.socket (and just doing the \\.\pipe concatenation once), the time it takes to call CreateFile repeatedly should be lessened
only checks for os_name == "Windows" in relation to use_lua_io once
The downsides:
makes the Lua script larger because of the function to convert from UTF-8 to UTF-16 so CreateFileW will accept it
not a problem now, but if options.socket is set to another value later on by the script, winapi.socket_wc will need updating too
Not a groundbreaking speedup, and it does make the code larger which is why I left it out of #35, but this makes the following relatively small changes:
replaces the use of
CreateFileA
withCreateFileW
. The Unicode (UTF-16) WinAPI is the actual native one on Windows, andCreateFileA
probably ends up callingMultiByteToWideChar
andCreateFileW
itself at some point. By storing the wide-char (UTF-16) version ofoptions.socket
(and just doing the\\.\pipe
concatenation once), the time it takes to callCreateFile
repeatedly should be lessenedonly checks for
os_name == "Windows"
in relation touse_lua_io
onceThe downsides:
makes the Lua script larger because of the function to convert from UTF-8 to UTF-16 so
CreateFileW
will accept itnot a problem now, but if
options.socket
is set to another value later on by the script,winapi.socket_wc
will need updating too