summaryrefslogtreecommitdiff
path: root/Types/UUID.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2021-08-10 20:45:02 -0400
committerJoey Hess <joeyh@joeyh.name>2021-08-11 12:13:31 -0400
commitfa62c98910746c2c5dda21b3f80effc147a04f65 (patch)
tree569b3a4c859e8aad647599d26abddc4c3121e29d /Types/UUID.hs
parenta38b724bfae767bd651d715d584eb222a6d06ddd (diff)
simplify and speed up Utility.FileSystemEncoding
This eliminates the distinction between decodeBS and decodeBS', encodeBS and encodeBS', etc. The old implementation truncated at NUL, and the primed versions had to do extra work to avoid that problem. The new implementation does not truncate at NUL, and is also a lot faster. (Benchmarked at 2x faster for decodeBS and 3x for encodeBS; more for the primed versions.) Note that filepath-bytestring 1.4.2.1.8 contains the same optimisation, and upgrading to it will speed up to/fromRawFilePath. AFAIK, nothing relied on the old behavior of truncating at NUL. Some code used the faster versions in places where I was sure there would not be a NUL. So this change is unlikely to break anything. Also, moved s2w8 and w82s out of the module, as they do not involve filesystem encoding really. Sponsored-by: Shae Erisson on Patreon
Diffstat (limited to 'Types/UUID.hs')
-rw-r--r--Types/UUID.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/Types/UUID.hs b/Types/UUID.hs
index b15fc39d7e..3e59fc685c 100644
--- a/Types/UUID.hs
+++ b/Types/UUID.hs
@@ -48,10 +48,10 @@ instance ToUUID B.ByteString where
| otherwise = UUID b
instance FromUUID String where
- fromUUID s = decodeBS' (fromUUID s)
+ fromUUID s = decodeBS (fromUUID s)
instance ToUUID String where
- toUUID s = toUUID (encodeBS' s)
+ toUUID s = toUUID (encodeBS s)
instance FromUUID ConfigValue where
fromUUID s = (ConfigValue (fromUUID s))