diff --git a/README.md b/README.md index e141d853a..2f5deb507 100755 --- a/README.md +++ b/README.md @@ -718,6 +718,7 @@ The play HTTP FLV benchmark by [SB](https://github.com/simple-rtmp-server/srs-be | 2014-05-24 | 2.0.167 | 1.0k(1000) | players | 82% | 86MB | - | | 2014-05-24 | 2.0.168 | 2.3k(2300) | players | 92% | 276MB | [code][p17] | | 2014-05-24 | 2.0.169 | 3.0k(3000) | players | 94% | 188MB | [code][p18] | +| 2014-05-24 | 2.0.170 | 3.0k(3000) | players | 89% | 96MB | [code][p19] | ### Latency benchmark diff --git a/trunk/src/app/srs_app_http_conn.cpp b/trunk/src/app/srs_app_http_conn.cpp index 682d936fb..d334b86d8 100644 --- a/trunk/src/app/srs_app_http_conn.cpp +++ b/trunk/src/app/srs_app_http_conn.cpp @@ -66,11 +66,14 @@ SrsHttpResponseWriter::SrsHttpResponseWriter(SrsStSocket* io) content_length = -1; written = 0; header_sent = false; + nb_iovss_cache = 0; + iovss_cache = NULL; } SrsHttpResponseWriter::~SrsHttpResponseWriter() { srs_freep(hdr); + srs_freep(iovss_cache); } int SrsHttpResponseWriter::final_request() @@ -173,8 +176,12 @@ int SrsHttpResponseWriter::writev(iovec* iov, int iovcnt, ssize_t* pnwrite) // send in chunked encoding. int nb_iovss = iovcnt * 4; - iovec* iovss = new iovec[nb_iovss]; - SrsAutoFree(iovec, iovss); + iovec* iovss = iovss_cache; + if (nb_iovss_cache < nb_iovss) { + srs_freep(iovss_cache); + nb_iovss_cache = nb_iovss; + iovss = iovss_cache = new iovec[nb_iovss]; + } char* pheader_cache = header_cache; for (int i = 0; i < iovcnt; i++) { diff --git a/trunk/src/app/srs_app_http_conn.hpp b/trunk/src/app/srs_app_http_conn.hpp index c6ec02795..0a093afa4 100644 --- a/trunk/src/app/srs_app_http_conn.hpp +++ b/trunk/src/app/srs_app_http_conn.hpp @@ -85,7 +85,10 @@ class SrsHttpResponseWriter : public ISrsHttpResponseWriter private: SrsStSocket* skt; SrsHttpHeader* hdr; +private: char header_cache[SRS_HTTP_HEADER_CACHE_SIZE]; + iovec* iovss_cache; + int nb_iovss_cache; private: // reply header has been (logically) written bool header_wrote; diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index 9b842b886..572399be6 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // current release version #define VERSION_MAJOR 2 #define VERSION_MINOR 0 -#define VERSION_REVISION 169 +#define VERSION_REVISION 170 // server info. #define RTMP_SIG_SRS_KEY "SRS"