[ 
https://issues.apache.org/jira/browse/PIG-1755?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12970338#action_12970338
 ] 

Scott Carey commented on PIG-1755:
----------------------------------

instanceof is slower, but in this case the performance is dominated by the 
large amounts of object creation in pig.  In order to subtract two Integers, 
you have to create a third.   That single object allocation and the resulting 
GC is an order of magnitude more costly than the difference between instanceof 
and ==.

The cleanup is nice, and if changed to an enum there are more gains -- a switch 
on an enum is faster than cascaded if/else.



> Clean up duplicated code in Physical Operators
> ----------------------------------------------
>
>                 Key: PIG-1755
>                 URL: https://issues.apache.org/jira/browse/PIG-1755
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Dmitriy V. Ryaboy
>            Assignee: Dmitriy V. Ryaboy
>            Priority: Minor
>             Fix For: 0.9.0
>
>         Attachments: PIG-1755.patch
>
>
> A lot of the getNext() implementations in PhysicalOperators is copy-pasted, 
> with only the method signatures and casts changing. 
> Shorter code leads to less bugs and is easier to read.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to