Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Alex D
GHC
Commits
789690fc
Commit
789690fc
authored
Feb 27, 2010
by
ich@christoph-bauer.net
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
a faster appendFS
parent
51ab3ed1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
compiler/utils/FastString.lhs
compiler/utils/FastString.lhs
+12
-1
No files found.
compiler/utils/FastString.lhs
View file @
789690fc
...
...
@@ -449,7 +449,18 @@ zEncodeFS fs@(FastString _ _ _ _ enc) =
return efs
appendFS :: FastString -> FastString -> FastString
appendFS fs1 fs2 = mkFastString (unpackFS fs1 ++ unpackFS fs2)
appendFS fs1 fs2 =
inlinePerformIO $ do
r <- mallocForeignPtrBytes len
withForeignPtr r $ \ r' -> do
withForeignPtr (buf fs1) $ \ fs1Ptr -> do
withForeignPtr (buf fs2) $ \ fs2Ptr -> do
copyBytes r' fs1Ptr len1
copyBytes (advancePtr r' len1) fs2Ptr len2
mkFastStringForeignPtr r' r len
where len = len1 + len2
len1 = lengthFS fs1
len2 = lengthFS fs2
concatFS :: [FastString] -> FastString
concatFS ls = mkFastString (Prelude.concat (map unpackFS ls)) -- ToDo: do better
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment