RFR: 8347167: Implementation in com.sun.net.httpserver.Headers.normalize() can be improved [v2]
Volkan Yazici
vyazici at openjdk.org
Tue Nov 18 12:42:15 UTC 2025
On Mon, 17 Nov 2025 16:06:55 GMT, Josiah Noel <duke at openjdk.org> wrote:
>> Following the direction outlined in the net-dev discussion, I've updated the `com.sun.net.httpserver.Headers.normalize()` method to no longer allocate a superfluous char array when the header is already normalized.
>
> Josiah Noel has updated the pull request incrementally with one additional commit since the last revision:
>
> patch
Attaching the benchmark results for the record:
$ git merge upstream/master
$ make run-test TEST="micro:HeaderNormalization" MICRO="OPTIONS=-prof gc
Benchmark (key) Mode Cnt Score Error Units
HeaderNormalization.n25 Accept-charset avgt 15 12.673 ± 0.248 ns/op
HeaderNormalization.n25:gc.alloc.rate Accept-charset avgt 15 7826.300 ± 154.610 MB/sec
HeaderNormalization.n25:gc.alloc.rate.norm Accept-charset avgt 15 104.000 ± 0.001 B/op
HeaderNormalization.n25:gc.count Accept-charset avgt 15 82.000 counts
HeaderNormalization.n25:gc.time Accept-charset avgt 15 61.000 ms
HeaderNormalization.n25 accept-charset avgt 15 12.728 ± 0.277 ns/op
HeaderNormalization.n25:gc.alloc.rate accept-charset avgt 15 7793.079 ± 170.106 MB/sec
HeaderNormalization.n25:gc.alloc.rate.norm accept-charset avgt 15 104.000 ± 0.001 B/op
HeaderNormalization.n25:gc.count accept-charset avgt 15 87.000 counts
HeaderNormalization.n25:gc.time accept-charset avgt 15 62.000 ms
HeaderNormalization.n25 Accept-Charset avgt 15 12.491 ± 0.273 ns/op
HeaderNormalization.n25:gc.alloc.rate Accept-Charset avgt 15 7940.943 ± 173.267 MB/sec
HeaderNormalization.n25:gc.alloc.rate.norm Accept-Charset avgt 15 104.000 ± 0.001 B/op
HeaderNormalization.n25:gc.count Accept-Charset avgt 15 86.000 counts
HeaderNormalization.n25:gc.time Accept-Charset avgt 15 67.000 ms
HeaderNormalization.n25 ACCEPT-CHARSET avgt 15 12.783 ± 0.222 ns/op
HeaderNormalization.n25:gc.alloc.rate ACCEPT-CHARSET avgt 15 7758.515 ± 132.436 MB/sec
HeaderNormalization.n25:gc.alloc.rate.norm ACCEPT-CHARSET avgt 15 104.000 ± 0.001 B/op
HeaderNormalization.n25:gc.count ACCEPT-CHARSET avgt 15 91.000 counts
HeaderNormalization.n25:gc.time ACCEPT-CHARSET avgt 15 64.000 ms
HeaderNormalization.n26 Accept-charset avgt 15 7.871 ± 0.056 ns/op
HeaderNormalization.n26:gc.alloc.rate Accept-charset avgt 15 0.007 ± 0.001 MB/sec
HeaderNormalization.n26:gc.alloc.rate.norm Accept-charset avgt 15 ≈ 10⁻⁴ B/op
HeaderNormalization.n26:gc.count Accept-charset avgt 15 ≈ 0 counts
HeaderNormalization.n26 accept-charset avgt 15 12.864 ± 0.225 ns/op
HeaderNormalization.n26:gc.alloc.rate accept-charset avgt 15 7709.843 ± 136.491 MB/sec
HeaderNormalization.n26:gc.alloc.rate.norm accept-charset avgt 15 104.000 ± 0.001 B/op
HeaderNormalization.n26:gc.count accept-charset avgt 15 81.000 counts
HeaderNormalization.n26:gc.time accept-charset avgt 15 60.000 ms
HeaderNormalization.n26 Accept-Charset avgt 15 15.299 ± 0.407 ns/op
HeaderNormalization.n26:gc.alloc.rate Accept-Charset avgt 15 6485.181 ± 174.316 MB/sec
HeaderNormalization.n26:gc.alloc.rate.norm Accept-Charset avgt 15 104.000 ± 0.001 B/op
HeaderNormalization.n26:gc.count Accept-Charset avgt 15 120.000 counts
HeaderNormalization.n26:gc.time Accept-Charset avgt 15 77.000 ms
HeaderNormalization.n26 ACCEPT-CHARSET avgt 15 13.601 ± 0.347 ns/op
HeaderNormalization.n26:gc.alloc.rate ACCEPT-CHARSET avgt 15 7294.108 ± 185.918 MB/sec
HeaderNormalization.n26:gc.alloc.rate.norm ACCEPT-CHARSET avgt 15 104.000 ± 0.001 B/op
HeaderNormalization.n26:gc.count ACCEPT-CHARSET avgt 15 117.000 counts
HeaderNormalization.n26:gc.time ACCEPT-CHARSET avgt 15 78.000 ms
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27276#issuecomment-3547472395
More information about the net-dev
mailing list