nitely / nim-regex

Pure Nim regex engine. Guarantees linear time matching
https://nitely.github.io/nim-regex/
MIT License
227 stars 20 forks source link

Literal optimization #68

Closed nitely closed 4 years ago

nitely commented 4 years ago

fix #59

nitely commented 4 years ago
============================================================================
GlobalBenchmark                                 relative  time/iter  iters/s
============================================================================
GlobalBenchmark                                            294.86ps    3.39G
============================================================================
bench.nim                                       relative  time/iter  iters/s
============================================================================
re_email_find_all                                           24.19ms    41.33
email_find_all                                  3389.08%   713.91us    1.40K
re_uri_find_all                                             24.75ms    40.40
uri_find_all                                      92.92%    26.64ms    37.54
re_ip_find_all                                               6.41ms   156.06
ip_find_all                                      101.27%     6.33ms   158.04
runes                                                        5.99ms   167.04
dummy                                                        0.00fs      inf

^ I've some uncommitted code to get these numbers, where I just allocate "submatches" once.

timotheecour commented 4 years ago

can you explain a bit the table? what is re_email_find_all vs email_findall ? is `re` the std/re and the other one is your pkg/regex ?

so pkg/regex would be 33x slower than std/re for email_find_all task and about same speed for ip_find_all task?

nitely commented 4 years ago

is re_ the std/re and the other one is your pkg/regex ?

Yes.

so pkg/regex would be 33x slower than std/re for email_find_all task and about same speed for ip_find_all task?

It's 33x faster and about the same speed for the other tests.

timotheecour commented 4 years ago

oh dang, i misread us for ms! wow this is nice?

does a comparison against nre make sense?

nitely commented 4 years ago

does a comparison against nre make sense?

I just checked, and the numbers are about the same.