| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Thanks for the PR @sergeevik. Have you run some benchmarks on this? I suspect that there won't be much impact since the JVM does a lot of these optimizations already. |
Sorry, something went wrong.
|
@aeberhart Benchmarks are a complex thing. I tried them on simple examples and stumbled upon many JVM optimizations (due to the simplicity of the scenarios). This is more of a general practice (my experience). Regarding strings and creating new strings by appending to chars, the JVM might optimize them, but there's no point in waiting for JIT to notice. String appending in a loop is never optimized by JIT. Regex compilation is useful because JIT doesn't do it itself. The JVM might cache some things, but not much. |
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
|
Hi @aeberhart, I removed my the String.valueOf s—they're probably pointless. I left the StringBuilder in the loop because it's still not optimized by the JIT. Also left the regex as constants. Removed the string handling in the signature calculation and reworked it to use characters (since it's essentially handling characters, but it creates extra strings). |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
string and regex optimisation
For string:
For regex:
JsonParser.java
replace readEscape logic with hex data (remove create string and parse it)