Skip to content

Commit

Permalink
Merge pull request #199 from JuliaIO/fw/stringvector
Browse files Browse the repository at this point in the history
Use StringVector instead of Vector{UInt8}
  • Loading branch information
TotalVerb authored Apr 23, 2017
2 parents c97b712 + 82b4b1e commit cbd9169
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
julia 0.4
Compat 0.17.0
Compat 0.24.0
3 changes: 2 additions & 1 deletion src/specialized.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Specialized functions for increased performance when JSON is in-memory
using Compat: StringVector

function parse_string(ps::MemoryParserState)
# "Dry Run": find length of string so we can allocate the right amount of
# memory from the start. Does not do full error checking.
fastpath, len = predict_string(ps)

# Now read the string itself
b = Vector{UInt8}(len)
b = StringVector(len)

# Fast path occurs when the string has no escaped characters. This is quite
# often the case in real-world data, especially when keys are short strings.
Expand Down

0 comments on commit cbd9169

Please sign in to comment.