From: Sean Cannella Date: Wed, 25 Feb 2015 18:34:25 +0000 (-0800) Subject: Reduce AsyncSocket code size X-Git-Tag: v0.27.0~14 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=commitdiff_plain;h=1cb4f91b8870c5dd1dfb7ac515f081a522b19be8 Reduce AsyncSocket code size Summary: Manual inspection of AsyncSocket.o shows the constructors are generating ugly (and large) code. Call the smaller constructors instead of duplicating the code. This reduces the debug .o size from ~1.9MB to ~1.6MB. Test Plan: existing tests Reviewed By: benyluo@fb.com Subscribers: mzlee, folly-diffs@, yfeldblum, mathieubaudet, subodh, pgriess, benyluo FB internal diff: D1870896 Signature: t1:1870896:1424885638:d37fc79c0f88d04109c8bb73e632dc506b9f773b --- diff --git a/folly/io/async/AsyncSocket.cpp b/folly/io/async/AsyncSocket.cpp index c8754d2c..1d172504 100644 --- a/folly/io/async/AsyncSocket.cpp +++ b/folly/io/async/AsyncSocket.cpp @@ -179,7 +179,7 @@ AsyncSocket::AsyncSocket() : eventBase_(nullptr) , writeTimeout_(this, nullptr) , ioHandler_(this, nullptr) { - VLOG(5) << "new AsyncSocket(" << ")"; + VLOG(5) << "new AsyncSocket()"; init(); } @@ -194,11 +194,7 @@ AsyncSocket::AsyncSocket(EventBase* evb) AsyncSocket::AsyncSocket(EventBase* evb, const folly::SocketAddress& address, uint32_t connectTimeout) - : eventBase_(evb) - , writeTimeout_(this, evb) - , ioHandler_(this, evb) { - VLOG(5) << "new AsyncSocket(" << this << ", evb=" << evb << ")"; - init(); + : AsyncSocket(evb) { connect(nullptr, address, connectTimeout); } @@ -206,11 +202,7 @@ AsyncSocket::AsyncSocket(EventBase* evb, const std::string& ip, uint16_t port, uint32_t connectTimeout) - : eventBase_(evb) - , writeTimeout_(this, evb) - , ioHandler_(this, evb) { - VLOG(5) << "new AsyncSocket(" << this << ", evb=" << evb << ")"; - init(); + : AsyncSocket(evb) { connect(nullptr, ip, port, connectTimeout); }