Reduce AsyncSocket code size
authorSean Cannella <seanc@fb.com>
Wed, 25 Feb 2015 18:34:25 +0000 (10:34 -0800)
committerAlecs King <int@fb.com>
Tue, 3 Mar 2015 03:29:57 +0000 (19:29 -0800)
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

folly/io/async/AsyncSocket.cpp

index c8754d2c73437a96b147c0bfc535dd70faf501b2..1d172504d239f9476f5dc259eabf5b4078b803d0 100644 (file)
@@ -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);
 }