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

ASF GitHub Bot commented on DRILL-5899:
---------------------------------------

Github user ppadma commented on the issue:

    https://github.com/apache/drill/pull/1015
  
    @paul-rogers Thanks a lot for the review. Updated the PR with code review 
comments. Please take a look. 
    
    Overall, good improvement with this change. Here are the numbers.
    
    select count(*) from `/Users/ppenumarthy/MAPRTECH/padma/testdata` where 
l_comment like '%a' 
    1.4 sec vs 7 sec
    
    select count(*) from `/Users/ppenumarthy/MAPRTECH/padma/testdata` where 
l_comment like '%a%' 
    6.5 sec vs 13.5 sec
    
    select count(*) from `/Users/ppenumarthy/MAPRTECH/padma/testdata` where 
l_comment like 'a%' 
    1.4 sec vs 5.8 sec
    
    select count(*) from `/Users/ppenumarthy/MAPRTECH/padma/testdata` where 
l_comment like 'a' 
    1.1.65 sec vs 5.8 sec
    
    
    I think for "contains", improvement is not as much as others, probably 
because of nested for loops. @sachouche changes on top of these changes can 
improve further. 



> Simple pattern matchers can work with DrillBuf directly
> -------------------------------------------------------
>
>                 Key: DRILL-5899
>                 URL: https://issues.apache.org/jira/browse/DRILL-5899
>             Project: Apache Drill
>          Issue Type: Improvement
>          Components: Execution - Flow
>            Reporter: Padma Penumarthy
>            Assignee: Padma Penumarthy
>            Priority: Critical
>
> For the 4 simple patterns we have i.e. startsWith, endsWith, contains and 
> constant,, we do not need the overhead of charSequenceWrapper. We can work 
> with DrillBuf directly. This will save us from doing isAscii check and UTF8 
> decoding for each row.
> UTF-8 encoding ensures that no UTF-8 character is a prefix of any other valid 
> character. So, instead of decoding varChar from each row we are processing, 
> encode the patternString once during setup and do raw byte comparison. 
> Instead of bounds checking and reading one byte at a time, we get the whole 
> buffer in one shot and use that for comparison.
> This improved overall performance for filter operator by around 20%. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to