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:04:00 UTC
[jira] [Updated] (GROOVY-10395) SC: <=> compiled to ScriptBytecodeAdapter#compareTo for primitives
[ https://issues.apache.org/jira/browse/GROOVY-10395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles updated GROOVY-10395:
---------------------------------
Description:
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 – instead it is transformed into {{ScriptBytecodeAdapter.compareTo(a,b)}}
was:
Consider the following:
{code:groovy}
@groovy.transform.CompileStatic
int test(int a, int b) {
a <=> b
}
{code}
"a <=> b" for primitive types is not optimized to make use of Integer#compare -- instead it is transformed into {{ScriptBytecodeAdapter.compareTo(a,b)}}
> 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 – instead it is transformed into {{ScriptBytecodeAdapter.compareTo(a,b)}}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)