я себе написал StringBuilder с аналогичной оптимизацией, если создавать новый билдер каждый раз, то он на порядок медленнее дефолтного, но если переиспользовать сущействующий, чтобы массив расширился до некоторого максимально значения только один раз, то такая оптимизация дает выигрыш примерно в 30%
Американский форум. Задаёшь вопрос, потом тебе отвечают.
Израильский форум. Задаёшь вопрос, потом тебе задают вопрос.
Русский форум. Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.
ab -n 100 -k -c 10 nxweb.org
This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, www.zeustech.net
Licensed to The Apache Software Foundation, www.apache.org
Benchmarking nxweb.org (be patient)...apr_pollset_poll: The timeout specified has expired (70007)
Total of 10 requests completed
если вырубить, не дожидаясь таймаута:
ab -n 100 -k -c 10 nxweb.org
ab -n 100 -k -c 10 nxweb.org
This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, www.zeustech.net
Licensed to The Apache Software Foundation, www.apache.org
Benchmarking nxweb.org (be patient)...^C
Server Software: nxweb/3.3.0-dev
Server Hostname: nxweb.org
Server Port: 80
Document Path: /
Document Length: 1199 bytes
Concurrency Level: 10
Time taken for tests: 3.558 seconds
Complete requests: 10
Failed requests: 2
(Connect: 0, Receive: 0, Length: 2, Exceptions: 0)
Non-2xx responses: 10
Keep-Alive requests: 10
Total transferred: 236160 bytes
HTML transferred: 231922 bytes
Requests per second: 2.81 [#/sec] (mean)
Time per request: 3557.915 [ms] (mean)
Time per request: 355.791 [ms] (mean, across all concurrent requests)
Transfer rate: 64.82 [Kbytes/sec] received
Connection Times (ms)
min mean[±sd] median max
Connect: 3 3 0.2 3 4
Processing: 14 39 22.7 58 64
Waiting: 14 39 22.7 58 64
Total: 17 42 22.7 62 67
This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, www.zeustech.net
Licensed to The Apache Software Foundation, www.apache.org
Benchmarking nxweb.org (be patient)...apr_pollset_poll: The timeout specified has expired (70007)
Total of 10 requests completed
если вырубить, не дожидаясь таймаута:
This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, www.zeustech.net
Licensed to The Apache Software Foundation, www.apache.org
Benchmarking nxweb.org (be patient)...^C
Server Software: nxweb/3.3.0-dev
Server Hostname: nxweb.org
Server Port: 80
Document Path: /
Document Length: 1199 bytes
Concurrency Level: 10
Time taken for tests: 3.558 seconds
Complete requests: 10
Failed requests: 2
(Connect: 0, Receive: 0, Length: 2, Exceptions: 0)
Non-2xx responses: 10
Keep-Alive requests: 10
Total transferred: 236160 bytes
HTML transferred: 231922 bytes
Requests per second: 2.81 [#/sec] (mean)
Time per request: 3557.915 [ms] (mean)
Time per request: 355.791 [ms] (mean, across all concurrent requests)
Transfer rate: 64.82 [Kbytes/sec] received
Connection Times (ms)
min mean[±sd] median max
Connect: 3 3 0.2 3 4
Processing: 14 39 22.7 58 64
Waiting: 14 39 22.7 58 64
Total: 17 42 22.7 62 67
выключение лога помогло незначительно, теперь примерно 2.3к рпс