Github user HeartSaVioR commented on a diff in the pull request:

    https://github.com/apache/storm/pull/669#discussion_r37170060
  
    --- Diff: external/storm-kafka/src/jvm/storm/kafka/PartitionManager.java ---
    @@ -137,8 +137,14 @@ public EmitState next(SpoutOutputCollector collector) {
                 }
                 Iterable<List<Object>> tups = 
KafkaUtils.generateTuples(_spoutConfig, toEmit.msg);
                 if (tups != null) {
    -                for (List<Object> tup : tups) {
    -                    collector.emit(tup, new KafkaMessageId(_partition, 
toEmit.offset));
    +           if(_spoutConfig.topicAsStreamId) {
    +               for (List<Object> tup : tups) {
    --- End diff --
    
    @harshach 
    @rohanag12's approach reduces execution of if statement to just once.
    (And I'm not sure compiler optimization takes care of it.)
    It may hurt readability slightly by code duplication, but I think it is 
small enough.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to