Giter Site home page Giter Site logo

Comments (13)

misalcedo avatar misalcedo commented on June 24, 2024

Completed the implementation of version 2.0 for the text protocol. Tests, benchmarks, and documentation are also in place.

Next step is doing the same thing for the binary format.

from ppp.

misalcedo avatar misalcedo commented on June 24, 2024

Also, need to update the benchmarks to use groups to reduce repetition

from ppp.

misalcedo avatar misalcedo commented on June 24, 2024

Description

Benchmarks run on a 4-core CodeSpace for the text format of the PROXY protocol to compare version 1.X to version 2.0 of this library.

Run with

cargo clean
cargo bench --bench text

Results

ppp text tcp4           time:   [260.37 ns 263.75 ns 267.50 ns]                          
ppp v2 text tcp4        time:   [246.77 ns 249.58 ns 253.18 ns]                             

ppp text tcp6           time:   [540.65 ns 549.96 ns 560.46 ns]                           
ppp v2 text tcp6        time:   [563.97 ns 568.39 ns 573.90 ns]                              

ppp text tcp6 compact   time:   [423.18 ns 430.20 ns 437.74 ns]                                  
ppp v2 text tcp6 compact                                                                            
                        time:   [421.68 ns 426.35 ns 431.81 ns]

ppp header to text tcp4 time:   [253.92 ns 258.40 ns 263.87 ns]                                    
ppp v2 header to text tcp4                                                                             
                        time:   [34.776 ns 35.219 ns 35.768 ns]
ppp v2 addresses to text tcp4  
                        time:   [266.92 ns 270.62 ns 275.02 ns]

ppp header to text tcp6 time:   [545.64 ns 553.35 ns 562.49 ns]                                     
ppp v2 header to text tcp6                                                                             
                        time:   [38.176 ns 38.521 ns 38.910 ns]
ppp v2 addresses to text tcp6                                                                             
                        time:   [633.37 ns 646.07 ns 661.06 ns]

ppp header to text unknown                                                                            
                        time:   [50.763 ns 51.317 ns 51.997 ns]
ppp v2 header to text unknown                                                                             
                        time:   [35.056 ns 35.663 ns 36.375 ns]
ppp v2 addresses to text unknown
                        time:   [31.359 ns 31.745 ns 32.207 ns]

Summary

In every case for parsing, version 2.0 is slightly faster or virtually the same performance.
In every case for displaying, version 2.0 is significantly faster as it maintains a reference to the original header input string.

Even in cases where version 2.0 is slower that is because we turn the string to bytes and have to turn the whole thing back to a UTF8 string. Version 1.x only turned the necessary portions into a UTF8 string and left the rest as bytes. That likely accounts for the slight performance penalty on the longer IPv6 headers.

from ppp.

misalcedo avatar misalcedo commented on June 24, 2024

Need to update the benchmark id's to work with gnuplot

from ppp.

misalcedo avatar misalcedo commented on June 24, 2024

Use starts with for slices in V1 and v2. Implement from for tlv iterator.

from ppp.

misalcedo avatar misalcedo commented on June 24, 2024

Want to implement display for address in V1.
Also, implement various format traits for V2.

from ppp.

misalcedo avatar misalcedo commented on June 24, 2024

Most of the binary format is implemented. I still need to implement the remaining tests. Then, I need to think through how to write a header to binary for using the library during testing. Minimum is: protocol, command, addresses, tlvs.

from ppp.

misalcedo avatar misalcedo commented on June 24, 2024

Remove length property from header in favor of computing the length.

from ppp.

misalcedo avatar misalcedo commented on June 24, 2024

Remaining steps:

  • Tests for v2.
  • as_bytes() or equivalent trait implementation for v2.
  • Update Benchmarks.
  • Add builder, tests, and benchmarks.
  • Optimize.
  • streaming support for v1 similar to v2

from ppp.

misalcedo avatar misalcedo commented on June 24, 2024
  • Add From impl for addresses to u16
  • add update length to builder
  • add with TLVs and singular to builder
  • add tests for the builder.

from ppp.

misalcedo avatar misalcedo commented on June 24, 2024
PPP Binary/v2::Header::try_from/IPv4 with TLVs                                                                             
                        time:   [7.1025 ns 7.1821 ns 7.2757 ns]
PPP Binary/parse_header/IPv4 with TLVs                                                                             
                        time:   [38.795 ns 39.296 ns 39.838 ns]
PPP Binary/v2::Header::try_from/IPv6 without TLVs                                                                             
                        time:   [19.934 ns 20.229 ns 20.577 ns]
PPP Binary/parse_header/IPv6 without TLVs                                                                            
                        time:   [141.57 ns 144.12 ns 147.05 ns]

from ppp.

misalcedo avatar misalcedo commented on June 24, 2024

Builder:

  • add set length
  • add with addresses
  • make write tlvs take an into tlv
  • add from for tlv-like tuples
  • add new, with length, padding, and empty to create tlvs.
  • impl write for builder
  • Create to header trait
  • add to bytes default method to trait
  • add from vec for writer, add finish to writer
  • partial result trait with impl for V1 and v2 results
  • examples

from ppp.

misalcedo avatar misalcedo commented on June 24, 2024

Remaining tasks:

  • v2 module documentation
  • lib documentation
  • Update README with minimal code sample
  • Update README with reference to examples and how to run them
  • Update README with benchmarking instructions
  • Update README with profiling instructions
  • Support windows compilation
  • Optimize v1 module to at least match the performance of ppp 1.0's text module

from ppp.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.