From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Antipov Newsgroups: gmane.emacs.devel Subject: Re: Benchmarking temporary Lisp objects [Was: Re: [RFC] temporary Lisp_Strings] Date: Thu, 04 Sep 2014 18:46:54 +0400 Message-ID: <54087B5E.10402@yandex.ru> References: <5405BE5D.1090003@yandex.ru> <5405DE8B.4050201@yandex.ru> <5406EC21.4060200@yandex.ru> <5407281C.3090302@cs.ucla.edu> <54073621.2040403@yandex.ru> <540744F5.2010804@cs.ucla.edu> <5407F1B7.6090704@yandex.ru> <5407F4E6.2040809@cs.ucla.edu> <5407FDF4.7020504@yandex.ru> <54086B1A.8070506@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1409842046 19930 80.91.229.3 (4 Sep 2014 14:47:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 4 Sep 2014 14:47:26 +0000 (UTC) Cc: Stefan Monnier , Emacs development discussions To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 04 16:47:19 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XPYJi-0005O7-GB for ged-emacs-devel@m.gmane.org; Thu, 04 Sep 2014 16:47:18 +0200 Original-Received: from localhost ([::1]:51508 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPYJh-0000DE-Tc for ged-emacs-devel@m.gmane.org; Thu, 04 Sep 2014 10:47:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPYJZ-0000Bu-18 for emacs-devel@gnu.org; Thu, 04 Sep 2014 10:47:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPYJS-0001VA-1B for emacs-devel@gnu.org; Thu, 04 Sep 2014 10:47:08 -0400 Original-Received: from forward5p.cmail.yandex.net ([77.88.31.20]:51761) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPYJR-0001V5-Md for emacs-devel@gnu.org; Thu, 04 Sep 2014 10:47:01 -0400 Original-Received: from smtp19.mail.yandex.net (smtp19.mail.yandex.net [95.108.252.19]) by forward5p.cmail.yandex.net (Yandex) with ESMTP id 3A982FF0; Thu, 4 Sep 2014 18:46:56 +0400 (MSK) Original-Received: from smtp19.mail.yandex.net (localhost [127.0.0.1]) by smtp19.mail.yandex.net (Yandex) with ESMTP id D6571BE005D; Thu, 4 Sep 2014 18:46:55 +0400 (MSK) Original-Received: from unknown (unknown [37.139.80.10]) by smtp19.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id fkMCw0xoRB-ktr8o3Dr; Thu, 4 Sep 2014 18:46:55 +0400 (using TLSv1.2 with cipher AES128-SHA (128/128 bits)) (Client certificate not present) X-Yandex-Uniq: 4cb0ded5-321c-4dae-a0ea-4a8005220af9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1409842015; bh=DWFZZM4+hUurso1E+Il19OUEOFuQSOzV8RL636WDasA=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=DbfWcskXdDWPkKp/UL1s9z1yILzpXG8jsAVTQbUufk/dR+u1zsLDAZAo5rzRLCQ/5 zO3QcgVFG6I507M5MrGV9JI7jONgxoKP6RuAjJTjV3g09tfzsHmYYo1+BML8Xyi4wt u9uFExXT8OOnrfHzEV7Ev1cEqMtoe/d8yp9P14Q0= Authentication-Results: smtp19.mail.yandex.net; dkim=pass header.i=@yandex.ru User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 In-Reply-To: <54086B1A.8070506@yandex.ru> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 77.88.31.20 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:174008 Archived-At: On 09/04/2014 05:37 PM, Dmitry Antipov wrote: > Thanks to Paul, there is a C99-compilant solution: As for the vectors, I don't know how to use VLAs in the way similar to alloca in the following attempt: INLINE Lisp_Object local_vector_init (uintptr_t addr, ptrdiff_t length, Lisp_Object init) { ptrdiff_t i; struct Lisp_Vector *v = (struct Lisp_Vector *) addr; v->header.size = length; for (i = 0; i < length; i++) v->contents[i] = init; return make_lisp_ptr (v, Lisp_Vectorlike); } #define local_vector(obj, length, init) \ (MAX_ALLOCA < (length) * word_size + header_size \ ? Fmake_vector (make_number (length), (init)) \ : (obj = XIL ((uintptr_t) alloca ((length) * word_size + header_size)), \ local_vector_init ((uintptr_t) XLI (obj), (length), (init)))) Users are expected to call: Lisp_Object obj = local_vector (obj, 10, Qnil); Somewhat similar may be implemented for strings. Dmitry