From dev-return-4893-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Fri May 25 11:03:09 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 5019F180627 for ; Fri, 25 May 2018 11:03:08 +0200 (CEST) Received: (qmail 86267 invoked by uid 500); 25 May 2018 09:03:07 -0000 Mailing-List: contact dev-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list dev@groovy.apache.org Received: (qmail 86251 invoked by uid 99); 25 May 2018 09:03:06 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 May 2018 09:03:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 3C2EACF2B0 for ; Fri, 25 May 2018 09:03:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.182 X-Spam-Level: *** X-Spam-Status: No, score=3.182 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, T_DKIMWL_WL_MED=-0.01, URI_HEX=1.313] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id GSB2zB77twBV for ; Fri, 25 May 2018 09:03:03 +0000 (UTC) Received: from mail-it0-f52.google.com (mail-it0-f52.google.com [209.85.214.52]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 1B1215F41B for ; Fri, 25 May 2018 09:03:03 +0000 (UTC) Received: by mail-it0-f52.google.com with SMTP id y189-v6so5918071itb.2 for ; Fri, 25 May 2018 02:03:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=BRDc1xCUlOjpjiVEHoXG3X0hMoKLdy843nEpQmueUUI=; b=XIlStqbHQjELN6UKulSxhpmHzG0tsMdIPBn8wO1jsikLFIBFitT0CG8H9UL5kIlokr 8WgCKJbZchDCVMXecm8JOmwo9oaCIAYdGZ/02GUNaSEeDPjx9kab7YLCDgoTTWfdIWFA ladCNjo5p5gk6oAMe0Bjg0mtzuvSNcgRcE/DgG33mdJlf/Bk5D4uEDKAD2N3l9rs6mq3 Ky8GPfLYM8ljHYhxnyOGQe5GrRc1Xk1Y+ZYvoqg4N/ZJ53CKIVVL6OhhMGmqJaX4T1C8 Ryw02KEh+wWqHewtJEkW4dlYY3M+dpKkHDcntcq/rZys247cSTmc652MDQGUW33mT7w3 aesw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=BRDc1xCUlOjpjiVEHoXG3X0hMoKLdy843nEpQmueUUI=; b=UbbcfawY+C302cLCxGh0WqG1XxGX0USy7FBsBza7vN1uSwH3q/lanqDMwQouz+T/lp ZdxoOCuivnCan8kX43NNyh4jVm66rAETwVPVnQ6QkF4wQ8mnDukHh2NQAv+kmMm172Bs /jGOzvGJ8ScgvHekZuui2pYgQn6zS4IeQBeMBoiX//IgxDRcIxn8jcZNcnwP3eEEyrgV 2BYWkmp1HnfDuQr6F30MMdQX7NGtm0D86RhZAHYjenHfA59EClWM7XRbFNrxx/BSwmS/ H3+2A02qQDXESFgFF/eYtM+qM0TgGf/El305HZeFNhetxrAsQ7SOGI7ZbnoUj/bR5BhB gl/w== X-Gm-Message-State: ALKqPwfW4xBqLH1kVuLgNXWSVQNovWXTXJ7VTknoyxSKx1JY1yI+CDCu D6ehR99q1AKwb3Y+X5+fz4r1aTn8tytyF1U2Hfb/FQ== X-Google-Smtp-Source: ADUXVKIuxwkoHfzR4LXjNvWsLyw2vEmx2EBZkAipAP3PYufN7K2MCEjTjmP4BvG0D4Li8YOHm/x44vhF1IOm8MHBOJU= X-Received: by 2002:a24:7981:: with SMTP id z123-v6mr1189093itc.144.1527238981468; Fri, 25 May 2018 02:03:01 -0700 (PDT) MIME-Version: 1.0 References: <1527236242181-0.post@n5.nabble.com> In-Reply-To: <1527236242181-0.post@n5.nabble.com> From: =?UTF-8?Q?C=C3=A9dric_Champeau?= Date: Fri, 25 May 2018 11:02:49 +0200 Message-ID: Subject: Re: Performance of the compiler To: dev@groovy.apache.org Content-Type: multipart/alternative; boundary="000000000000fa4624056d0408d2" --000000000000fa4624056d0408d2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Be warned that caching may prove to be complicated: what if a class in the same compile unit is named `List`, or a class in the same package? This is one of the reasons the lookup is not cached for this. Le ven. 25 mai 2018 =C3=A0 10:17, Daniel.Sun a =C3=A9cr= it : > I am going to cache the class names of default imported packages, e.g. > `List`, `ArrayList`, `Map`, `HashMap`, etc. > > And try to find the name of ClassNode instance in the class names cache, = if > not found, `return false`(add the check at the line[1]). The polished log= ic > can avoid unnecessary resolving and improve the resolving performance > somehow. > > It's a pity that I have not found any approach to get all classes of the > given package, e.g. `java.lang`, `java.util` > Any help is appreciated. (Note: We can not use 3rd party library excludin= g > antlr, asm, cli) > > Cheers, > Daniel.Sun > [1] > > https://github.com/apache/groovy/blob/master/src/main/java/org/codehaus/g= roovy/control/ResolveVisitor.java#L513 > > > > -- > Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html > --000000000000fa4624056d0408d2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Be warned that caching may prove to be complicated: what i= f a class in the same compile unit is named `List`, or a class in the same = package? This is one of the reasons the lookup is not cached for this.
<= /div>
Le=C2=A0ven. 25 mai 20= 18 =C3=A0=C2=A010:17, Daniel.Sun <s= unlan@apache.org> a =C3=A9crit=C2=A0:
I am going to cache the class names of default imported packages,= e.g.
`List`, `ArrayList`, `Map`, `HashMap`, etc.

And try to find the name of ClassNode instance in the class names cache, if=
not found, `return false`(add the check at the line[1]). The polished logic=
can avoid unnecessary resolving and improve the resolving performance
somehow.

It's a pity that I have not found any approach to get all classes of th= e
given package, e.g. `java.lang`, `java.util`
Any help is appreciated. (Note: We can not use 3rd party library excluding<= br> antlr, asm, cli)

Cheers,
Daniel.Sun
[1]
https://github.com/apache/groovy/blob/master/src/main/java/org/= codehaus/groovy/control/ResolveVisitor.java#L513



--
Sent from: http://groovy.329449.n5.nabble.= com/Groovy-Dev-f372993.html
--000000000000fa4624056d0408d2--