From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: Optimizing =?utf-8?b?4oCYc3RyaW5nPeKAmQ==?= Date: Tue, 22 Jun 2010 22:51:13 +0200 Message-ID: References: <87k4pqj1pc.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1277239779 14476 80.91.229.12 (22 Jun 2010 20:49:39 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 22 Jun 2010 20:49:39 +0000 (UTC) Cc: guile-devel@gnu.org To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Jun 22 22:49:37 2010 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ORAPZ-0003Sc-3Z for guile-devel@m.gmane.org; Tue, 22 Jun 2010 22:49:37 +0200 Original-Received: from localhost ([127.0.0.1]:52591 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ORAPY-00045g-IO for guile-devel@m.gmane.org; Tue, 22 Jun 2010 16:49:36 -0400 Original-Received: from [140.186.70.92] (port=50762 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ORAPT-00045X-Sz for guile-devel@gnu.org; Tue, 22 Jun 2010 16:49:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ORAPS-0002xI-NF for guile-devel@gnu.org; Tue, 22 Jun 2010 16:49:31 -0400 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:47143 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ORAPS-0002uS-LS; Tue, 22 Jun 2010 16:49:30 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id C702ABE229; Tue, 22 Jun 2010 16:49:11 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=HNuCouJ5nwXu FnL55cj3e6eV1Co=; b=Go6aRL2gw/LyX2F1r0QlU6h49RSMvhgsjpgOh5yAngBL SoM+rUgCwCpuPgaqWdwKyR/0ww8WCXMzVEM9hzYsK0o+ZoKYEICKV6Vnp/b5GBNk U4EloFIB53/yr27PGUhRp/BvCc9wH0YBuUcfEg/zXlJ1HQilwgzs2yPV5bOsuPs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=sasl; b=n5ilka RLXuAZVefL+P8m/7Zty+KOVY5U9riu2k2sFILf2JxAQg1zH8iG7WG7kEKjnWdO2b 3sW+jXJRksF7tFZKKNcVZ56EnS9iI6wYmVW29qw56q5XPkUl7Ffp+Sq38EUSFJ/M 0h1FUOZUAM4SgT4+qdJwhbRytk31ZSd+LM2Nk= Original-Received: from a-pb-sasl-quonix. (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id A36DBBE223; Tue, 22 Jun 2010 16:49:09 -0400 (EDT) Original-Received: from unquote (unknown [83.32.68.226]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 9BA1BBE221; Tue, 22 Jun 2010 16:49:06 -0400 (EDT) In-Reply-To: <87k4pqj1pc.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Tue, 22 Jun 2010 21:40:15 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) X-Pobox-Relay-ID: 9B351012-7E3F-11DF-9FE8-9056EE7EF46B-02397024!a-pb-sasl-quonix.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:10550 Archived-At: Hi, Nice profile-driven debugging :) On Tue 22 Jun 2010 21:40, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > @@ -1168,6 +1168,21 @@ SCM_DEFINE (scm_string_eq, "string=3D", 2, 4, 0, > "value otherwise.") > #define FUNC_NAME s_scm_string_eq > { > + if (SCM_LIKELY (scm_i_is_narrow_string (s1) =3D=3D scm_i_is_narrow_str= ing (s2) > + && SCM_UNBNDP (start1) && SCM_UNBNDP (end1) > + && SCM_UNBNDP (start2) && SCM_UNBNDP (end2))) > + { > + size_t len1, len2; > + > + len1 =3D scm_i_string_length (s1); > + len2 =3D scm_i_string_length (s2); > + > + if (SCM_LIKELY (len1 =3D=3D len2)) > + return scm_from_bool (memcmp (scm_i_string_chars (s1), > + scm_i_string_chars (s2), > + len1) =3D=3D 0); > + } > + Nasty, but OK I guess if you need it. Why not also add a fast path for scm_is_eq (s1, s2), or for comparing stringbufs, or something ? > It=E2=80=99s quite inelegant, but it leads to a more balanced profile: > > samples % symbol name > 8079 23.3984 scm_string_eq > 5649 16.3606 vm_debug_engine > 5624 16.2882 scm_i_str2symbol ^ What is this doing here? And for the matter, what are the rest about? Did you just do a really short profile? > 2840 8.2252 scm_ihashq > 1755 5.0828 scm_i_string_hash > 1637 4.7411 scm_fluid_ref > 1027 2.9744 scm_i_string_ref > 1011 2.9281 scm_hash_fn_get_handle > 877 2.5400 scm_i_string_chars > 793 2.2967 scm_module_variable > 553 1.6016 scm_from_locale_stringn > 471 1.3641 scm_from_stringn > 426 1.2338 scm_sym2var > 384 1.1121 scm_i_make_string > 317 0.9181 scm_module_lookup Andy --=20 http://wingolog.org/