Skip to content

Do not parse numbers on url parsers - ipv4  #36

Description

@anonrig

EndsInNumber parses the number, but does not use the result of it. Just using the validations, without the parsing, would make ipv4 parsing 28% faster.

Similar comparison is: ada-url/ada#36

Activity

  1. debadree25 commented on Jan 16, 2023

    @debadree25

    So basically instead of int64_t num = ParseIPv4Number(last_str, last_str + last.size()); we would just use a validator here?

  2. anonrig commented on Jan 16, 2023

    @anonrig
    MemberAuthor

    There are 2 optimizations can be done here.

    1. Removing vector initialization on line 412
    std::vector<std::string> parts = SplitString(input, '.', false);
    
    1. Removing ParseIPv4Number and replacing it with a validator that returns boolean
    int64_t num = ParseIPv4Number(last_str, last_str + last.size());
    
  3. debadree25 commented on Jan 16, 2023

    @debadree25

    Understood! Thanks! will attempt this!

  4. miguelteixeiraa commented on Jan 16, 2023

    @miguelteixeiraa

    I'm really sorry @debadree25 ! : ((
    I was already working on it and should have commented something here.
    I apologize for that

  5. debadree25 commented on Jan 17, 2023

    @debadree25

    I'm really sorry @debadree25 ! : (( I was already working on it and should have commented something here. I apologize for that

    No issue at all checking out your PR to learn!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions