Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71132 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66197 invoked from network); 15 Jan 2014 06:58:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jan 2014 06:58:33 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain zend.com from 74.125.82.45 cause and error) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 74.125.82.45 mail-wg0-f45.google.com Received: from [74.125.82.45] ([74.125.82.45:38250] helo=mail-wg0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 03/61-52301-89136D25 for ; Wed, 15 Jan 2014 01:58:33 -0500 Received: by mail-wg0-f45.google.com with SMTP id n12so1364035wgh.12 for ; Tue, 14 Jan 2014 22:58:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=4u5IoXwPoYJOCvF28d5KvZN8jmFWdZjrfZnAv+dCygE=; b=H5VlggVnNwfQWIABegWJcsyls+ytPeL7wULUcd24aZT3QkD+DHwCjss/02WrDrcSpv ODPq5QV0+n+OR+w354UkCOpvoARZ6bQzF8SD0/6olxcCtCprQYEvumVRDu909yI5jGMP NytsRapCJcZrSmINKv3VAZGrIbFcJ4Jqnp7v8OtdSMIb4kPE0K0B8o3riaFLkKAo/xlY tkVOEj4XMtBrplgPYsepxxlH9xydwBbP9KECqDvIfgrCEzEhERmvlQYsVl3tSFBn6M6l PnGVHRJ9iabGiqhkJk8tqI+l+IgVJvsPASe02zfPjR+OMvA8CUxUnbtfBbd0xzNbRnkF 4big== X-Gm-Message-State: ALoCoQkCKr/e5mVOwrzktnMw/tqtYfQtaQGjduJEIHw4F9PfvGCBEv9UsZNpiGyy0SHI5PqTQiuzKJ3V8gEf5waIjhqt7kH2csjdJjkQO9q6jyj4929488EYcIRTOishgNZCoxqhgDC3 MIME-Version: 1.0 X-Received: by 10.180.211.161 with SMTP id nd1mr565814wic.41.1389769109561; Tue, 14 Jan 2014 22:58:29 -0800 (PST) Received: by 10.227.91.198 with HTTP; Tue, 14 Jan 2014 22:58:29 -0800 (PST) In-Reply-To: <52D5923E.2080009@gmx.net> References: <52D5923E.2080009@gmx.net> Date: Wed, 15 Jan 2014 10:58:29 +0400 Message-ID: To: Christian Seiler Cc: PHP Internals Content-Type: multipart/alternative; boundary=001a11c3818a18796904effcd6b7 Subject: Re: [PHP-DEV] New Memory Manager From: dmitry@zend.com (Dmitry Stogov) --001a11c3818a18796904effcd6b7 Content-Type: text/plain; charset=UTF-8 Hi Christian, It's a clear solution, but indirect call may cause a lot of branch miss-predictions, so it needs to be tested if it can improve performance. binary compatibility is going to be broken anyway, so it's not a problem. Thanks. Dmitry. On Tue, Jan 14, 2014 at 11:38 PM, Christian Seiler wrote: > Hi there, > > > (For example: may be someone would >> suggest how to avoid check for USE_ZEND_ALLOC=0 to allow system malloc() >> usage on each emalloc() call? >> > > Rename emalloc() -> real_emalloc(), then: > > .h: > extern void (*emalloc)(size_t n); > > .c: > void (*emalloc)(size_t n) = real_emalloc; > > startup code: > > if (USE_ZEND_ALLOC is 0) { > emalloc = malloc; > } > > Probably some adjustments needed (esp. for potentially different calling > conventions, so maybe malloc() will need a small wrapper), this is just > from the top of my head. > > Note: this breaks ABI compatibility on most archs (because it changes > the symbol type). But could be done independently of anything else. > > Note 2: Depending on system architecture, each call to the function may > incur an additional (small) penalty. No idea how this compares to the > penalty of the if() at the start of emalloc(). > > Regards, > Christian > > --001a11c3818a18796904effcd6b7--