Should we care?

Regular expressions are generally small. 
So the asymptotic complexity is not particularly important.

But regular expressions are often used to search large amounts of input.

regexp gives us fast, guaranteed linear search times.
But we pay for this with slower compilation times.

In my opinion, this is a good tradeoff.



On Wednesday, 3 June 2020 18:07:12 UTC+1, Ray Pereda wrote:
>
> I believe that the complexity of regexp.MustCompile() 
> <https://golang.org/pkg/regexp/#MustCompile> is linear based on this 
> comment in the regexp package overview. 
> <https://golang.org/pkg/regexp/#pkg-overview>
>
> "The regexp implementation provided by this package is guaranteed to run 
> in time linear in the size of the input"
>
>
> What is the complexity of regexp.MustCompile() 
> <https://golang.org/pkg/regexp/#MustCompile>? Is it linear in the length 
> of the regular expression?
>
> -ray
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/162b28e7-bd81-47d4-afb7-7fe9f8a15b8do%40googlegroups.com.

Reply via email to