Edgewall Software

Current XPath implementation is in most cases faster than previous one:

Previous XPath implementation

Testing self path                                                         
        Running on "small document" example:                              
                Just select:            76.293945 microseconds            
                __init__ + select:      112.304688 microseconds           
        Running on "big document" example:                                
                Just select:            207.519531 microseconds           
                __init__ + select:      244.140625 microseconds           
Testing quite long path                                                   
        Running on "small document" example:                              
                Just select:            104.980469 microseconds           
                __init__ + select:      213.623047 microseconds           
        Running on "big document" example:                                
                Just select:            334.472656 microseconds           
                __init__ + select:      444.335938 microseconds           
Testing quite long + parameter path                                       
        Running on "small document" example:                              
                Just select:            104.370117 microseconds           
                __init__ + select:      231.933594 microseconds           
        Running on "big document" example:                                
                Just select:            334.472656 microseconds           
                __init__ + select:      480.957031 microseconds           
Testing complicated path                                                  
        Running on "small document" example:                              
                Just select:            107.421875 microseconds           
                __init__ + select:      351.562500 microseconds           
        Running on "big document" example:                                
                Just select:            334.472656 microseconds           
                __init__ + select:      576.171875 microseconds           
Testing all text path                                                     
        Running on "small document" example:                              
                Just select:            98.266602 microseconds            
                __init__ + select:      152.587891 microseconds           
        Running on "big document" example:                                
                Just select:            305.175781 microseconds           
                __init__ + select:      361.328125 microseconds           
Testing tag text path                                                     
        Running on "small document" example:                              
                Just select:            104.980469 microseconds           
                __init__ + select:      183.105469 microseconds           
        Running on "big document" example:                                
                Just select:            312.500000 microseconds           
                __init__ + select:      390.625000 microseconds

Current XPath implementation

Testing self path                                                         
        Running on "small document" example:                              
                Just select:            72.631836 microseconds            
                __init__ + select:      111.694336 microseconds           
        Running on "big document" example:                                
                Just select:            216.064453 microseconds           
                __init__ + select:      258.789063 microseconds           
Testing quite long path                                                   
        Running on "small document" example:                              
                Just select:            64.697266 microseconds
                __init__ + select:      194.091797 microseconds
        Running on "big document" example:
                Just select:            163.574219 microseconds
                __init__ + select:      290.527344 microseconds
Testing quite long + parameter path
        Running on "small document" example:
                Just select:            64.697266 microseconds
                __init__ + select:      211.181641 microseconds
        Running on "big document" example:
                Just select:            162.353516 microseconds
                __init__ + select:      312.500000 microseconds
Testing complicated path
        Running on "small document" example:
                Just select:            106.811523 microseconds
                __init__ + select:      361.328125 microseconds
        Running on "big document" example:
                Just select:            278.320313 microseconds
                __init__ + select:      527.343750 microseconds
Testing all text path
        Running on "small document" example:
                Just select:            73.852539 microseconds
                __init__ + select:      131.835937 microseconds
        Running on "big document" example:
                Just select:            225.830078 microseconds
                __init__ + select:      285.644531 microseconds
Testing tag text path
        Running on "small document" example:
                Just select:            93.994141 microseconds
                __init__ + select:      187.988281 microseconds
        Running on "big document" example:
                Just select:            292.968750 microseconds
                __init__ + select:      385.742188 microseconds

Strategies

As one can see current implementation is rather faster than previous one. This is because "strategies" were used - for different path different implementations are used. Performance differences between strategies can be seen on following benchmark test's reults.

Testing self path                                                                     
        Running on "small document" example:                                          
                Just select:            73.242188 microseconds                        
                __init__ + select:      113.525391 microseconds                       
                GenericStrategy Strategy                                              
                        select:         109.252930 microseconds                       
                SingleAxisStrategy Strategy                                           
                        select:         71.411133 microseconds                        
        Running on "big document" example:                                            
                Just select:            214.843750 microseconds                       
                __init__ + select:      253.906250 microseconds                       
                GenericStrategy Strategy                                              
                        select:         327.148438 microseconds                       
                SingleAxisStrategy Strategy                                           
                        select:         213.623047 microseconds                       
Testing quite long path                                                               
        Running on "small document" example:                                          
                Just select:            65.917969 microseconds                        
                __init__ + select:      196.533203 microseconds                       
                GenericStrategy Strategy                                              
                        select:         109.252930 microseconds                       
                SimpleStrategy Strategy                                               
                        select:         65.917969 microseconds                        
        Running on "big document" example:                                            
                Just select:            163.574219 microseconds                       
                __init__ + select:      292.968750 microseconds                       
                GenericStrategy Strategy                                              
                        select:         278.320313 microseconds                       
                SimpleStrategy Strategy                                               
                        select:         163.574219 microseconds                       
Testing quite long + parameter path                                                   
        Running on "small document" example:                                          
                Just select:            66.528320 microseconds                        
                __init__ + select:      214.843750 microseconds                       
                GenericStrategy Strategy                                              
                        select:         109.863281 microseconds                       
                SimpleStrategy Strategy                                               
                        select:         65.307617 microseconds                        
        Running on "big document" example:                                            
                Just select:            162.353516 microseconds                       
                __init__ + select:      310.058594 microseconds                       
                GenericStrategy Strategy                                              
                        select:         275.878906 microseconds                       
                SimpleStrategy Strategy                                               
                        select:         163.574219 microseconds                       
Testing complicated path                                                              
        Running on "small document" example:                                          
                Just select:            111.694336 microseconds                       
                __init__ + select:      361.328125 microseconds                       
                GenericStrategy Strategy                                              
                        select:         109.863281 microseconds                       
        Running on "big document" example:                                            
                Just select:            280.761719 microseconds                       
                __init__ + select:      541.992187 microseconds                       
                GenericStrategy Strategy                                              
                        select:         278.320313 microseconds
Testing all text path
        Running on "small document" example:
                Just select:            73.852539 microseconds
                __init__ + select:      131.835937 microseconds
                GenericStrategy Strategy
                        select:         159.912109 microseconds
                SingleAxisStrategy Strategy
                        select:         73.242188 microseconds
                SimpleStrategy Strategy
                        select:         92.773437 microseconds
        Running on "big document" example:
                Just select:            224.609375 microseconds
                __init__ + select:      280.761719 microseconds
                GenericStrategy Strategy
                        select:         517.578125 microseconds
                SingleAxisStrategy Strategy
                        select:         224.609375 microseconds
                SimpleStrategy Strategy
                        select:         295.410156 microseconds
Testing tag text path
        Running on "small document" example:
                Just select:            96.435547 microseconds
                __init__ + select:      191.650391 microseconds
                GenericStrategy Strategy
                        select:         153.808594 microseconds
                SimpleStrategy Strategy
                        select:         95.825195 microseconds
        Running on "big document" example:
                Just select:            300.292969 microseconds
                __init__ + select:      395.507812 microseconds
                GenericStrategy Strategy
                        select:         485.839844 microseconds
                SimpleStrategy Strategy
                        select:         295.410156 microseconds