You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/11/28 18:05:00 UTC

[jira] [Commented] (GROOVY-10395) SC: <=> compiled to ScriptBytecodeAdapter#compareTo for primitives

    [ https://issues.apache.org/jira/browse/GROOVY-10395?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17450100#comment-17450100 ] 

Eric Milles commented on GROOVY-10395:
--------------------------------------

See also GROOVY-10239 and GROOVY-10383

> SC: <=> compiled to ScriptBytecodeAdapter#compareTo for primitives
> ------------------------------------------------------------------
>
>                 Key: GROOVY-10395
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10395
>             Project: Groovy
>          Issue Type: Improvement
>          Components: Static compilation
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>
> Consider the following:
> {code:groovy}
> @groovy.transform.CompileStatic
> int cmp(int a, int b) {
>   a <=> b
> }
> {code}
> "a <=> b" for primitive types is not optimized to make use of Integer#compare or similar – instead it is transformed into {{ScriptBytecodeAdapter.compareTo(a,b)}}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)