I've done some profiling over JSON marshalling and unmarshalling and it seems they are quite slow.
I set out to improving the performance and I can present a small victory: the improvement of JSONUtils.quote().
- reorganized the switch/case
- eliminated charAt() calls
- buffered chars for bulk appends (this brings the biggest improvement)
- replaced StringBuffer with StringBuilder
I don't know exactly how much faster it is, but let's just say that it went from the biggest hotspot to almost nothing.
I'm not sure what patching format is expected, I just zipped the source file. I guess you can figure it out yourself what the differences are.
Note: I used StringBuilder instead of StringBuffer, because I only use Java 6, but feel free to drop that change.
Log in to post a comment.