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

Aleksey Yeschenko commented on CASSANDRA-14367:
-----------------------------------------------

For what it's worth, this is not always an improvement. In some 
performance-sensitive cases I would much rather have a monomorphic call than 
turning things bimorphic or even megamorphic to save on array allocation.

See https://github.com/google/guava/issues/1268 for a similar discussion in 
Guava-land.

> prefer Collections.singletonList to Arrays.asList(one_element)
> --------------------------------------------------------------
>
>                 Key: CASSANDRA-14367
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-14367
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Dave Brosius
>            Assignee: Dave Brosius
>            Priority: Trivial
>             Fix For: 4.x
>
>         Attachments: 14367.txt
>
>
> small improvement, but Arrays.asList first creates an array, then wraps it 
> with a collections instance, whereas Collections.singletonList just creates 
> one small (one field) bean instance.
> so a small cut down on garbage generated.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to