Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-2726

Templatize RawValue::GetHashValue to avoid per row PrimitiveType check for 6% Perf improvement

    XMLWordPrintableJSON

Details

    Description

      When looking at performance of ProbeFilters I realized that the type check for every row is consuming 7% of overall CPU.
      We should use templates for

      RawValue::GetHashValue()

      to avoid all the expensive branches.

      Function-Stack Effective-Time-by-Utilization Effective-Time-by-Utilization
      ----impala::Thread::SuperviseThread 97.20% 0s
      ------boost::function0<void>::operator() 97.20% 0s
      --------impala::HdfsScanNode::ScannerThread 87.60% 0s
      ----------impala::HdfsParquetScanner::ProcessSplit 87.60% 0s
      -----------impala::HdfsParquetScanner::AssembleRows<(bool)0,(bool)0> 87.60% 2.144s
      --------------ReadRow<false> 75.10% 1.433s
      ---------------impala::HdfsParquetScanner::ScalarColumnReader<long,(bool)1>::ReadNonRepeatedValue 69.90% 1.188s
      ------------------ReadValue<false> 66.30% 0.210s
      --------------------ReadSlot<false> 55.10% 1.930s
      ----------------------Get<true> 25.70% 8.539s
      ----------------------impala::DictDecoder<long>::GetValue 11.60% 1.510s
      ----------------------impala::HashUtil::Hash 6.20% 1.010s
      ----------------------impala::RawValue::GetHashValue 5.80% 1.918s

      Perf data for

      RawValue::GetHashValue

      , sampling is based on cycles

      impala::RawValue::GetHashValue(void const*, impala::ColumnType const&, unsigned int)
             │     Disassembly of section .text:                                                                                               
             │                                                                                                                                 
             │     00000000009ba270 <impala::RawValue::GetHashValue(void const*, impala::ColumnType const&, unsigned int)>:                    
        8.15 │       test   %rdi,%rdi                                                                                                          
             │     ↓ je     e0                                                                                                                 
        7.98 │       mov    (%rsi),%eax                                                                                                        
        1.78 │       cmp    $0x10,%eax                                                                                                         
             │     ↓ jbe    18                                                                                                                 
             │       xor    %eax,%eax                                                                                                          
             │     ← retq                                                                                                                      
             │       nop                                                                                                                       
        7.47 │ 18:   lea    typeinfo name for boost::detail::sp_counted_impl_p<impala::ClientCacheHelper::PerHostCache,%rcx                    
             │       mov    %eax,%r8d                                                                                                          
        7.08 │       movslq (%rcx,%r8,4),%r8                                                                                                   
       38.06 │       lea    (%r8,%rcx,1),%rcx                                                                                                  
       15.39 │     ↓ jmpq   ffffffffffffffff                                                                                                   
             │       nop                                                                                                                       
       13.81 │       mov    $0x8,%esi                                                                                                          
        0.29 │     ↓ jmpq   ffffffffffffffff                                                                                                   
             │       nop                                                                                                                       ◆
             │       mov    $0x4,%esi                                                                                                          
             │     ↓ jmpq   ffffffffffffffff                                                                                                   
             │       nop                                                                                                                       
             │       mov    0x8(%rdi),%esi                                                                                                     
             │       test   %esi,%esi                                                                                                          
             │     ↓ jne    130                                                                                                                
             │       mov    %edx,%ecx                                                                                                          
             │       mov    %edx,%eax                                                                                                          
             │       shl    $0x6,%ecx                                                                                                          
             │       shr    $0x2,%eax                                                                                                          
             │       lea    0x1c01f8a7(%rcx,%rax,1),%eax                                                                                       
             │       xor    %edx,%eax                                                                                                          
             │     ← retq                                                                                                                      
             │       nop                                                                                                                       
             │       mov    $0xc,%esi                                                                                                          
             │     ↓ jmpq   ffffffffffffffff                                                                                                   
             │       nop                                                                                                                       
             │       cmp    $0x10,%eax                                                                                                         
             │       mov    0x4(%rsi),%esi                                                                                                     
             │     ↓ je     100                                                                                                                
             │       cmp    $0xa,%eax                                                                                                          
      

      Attachments

        Issue Links

          Activity

            People

              mmokhtar Mostafa Mokhtar
              mmokhtar Mostafa Mokhtar
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: