File tree Expand file tree Collapse file tree
src/main/clojure/clojure/data Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -156,6 +156,8 @@ Change Log
156156 * Add [ DJSON-46] : In ` read ` , add ` :extra-data-fn ` that can be provided to cause an eof check after value is read
157157 * Add [ DJSON-54] : In ` write ` , add custom fallback fn for writing unknown types
158158 * Perf [ DJSON-61] : Faster string writing when string is "simple"
159+ * Perf: Faster string writing when string is not simple
160+ * Perf: Faster ` read-str `
159161* Release [ 2.4.0] on 2021-Jul-12
160162 * Fix [ DJSON-52] : Remove Classloader workaround to support Clojure 1.2.x and below
161163 * Fix [ DJSON-53] : Move deprecated API functions from compat ns into main ns
Original file line number Diff line number Diff line change 562562 shorts))
563563
564564(defn- slow-write-string [^CharSequence s ^Appendable out options]
565- (let [decoder codepoint-decoder]
565+ (let [decoder codepoint-decoder
566+ slash (get options :escape-slash )
567+ escape-js-separators (get options :escape-js-separators )
568+ escape-unicode (get options :escape-unicode )]
566569 (dotimes [i (.length s)]
567570 (let [cp (int (.charAt s i))]
568571 (if (< cp 128 )
569572 (case (aget decoder cp)
570573 0 (.append out (char cp))
571574 1 (do (.append out (char (codepoint \\))) (.append out (char cp)))
572- 2 (.append out (if ( get options :escape- slash) " \\ /" " /" ))
575+ 2 (.append out (if slash " \\ /" " /" ))
573576 3 (.append out " \\ b" )
574577 4 (.append out " \\ f" )
575578 5 (.append out " \\ n" )
576579 6 (.append out " \\ r" )
577580 7 (.append out " \\ t" )
578581 8 (->hex-string out cp))
579582 (codepoint-case cp
580- :js-separators (if ( get options : escape-js-separators)
583+ :js-separators (if escape-js-separators
581584 (->hex-string out cp)
582585 (.append out (char cp)))
583- (if ( get options : escape-unicode)
586+ (if escape-unicode
584587 (->hex-string out cp) ; Hexadecimal-escaped
585588 (.append out (char cp)))))))))
586589
You can’t perform that action at this time.
0 commit comments