Open cflewis opened 6 years ago
Hi Chris, I don't have any insights as to why importing 'regexp' is so much slower than other packages. I do suspect the same issue than you do though.
I can answer one thing though: 'fmt.Printf' returns the number of bytes written and an error. As the error is 'nil', it's elided from the printout. You do get the number of bytes though. Then you get the message being printed out.
Note there are built-in 'print' and 'printf' functions in ng that don't return '(int, error)'. You'd probably want to use those instead in scripts.
When I run
ng> import "regexp"
It takes a decent 3 to 4 seconds.
When I run
ng> import "strings"
it's as good as instant.
Even simple programs get hurt by this: If I wanted to write something that gets the path to a known parent directory (
google3
), I'd need to write:Is it simply because
regexp
has more imports thanstrings
, or doesstrings
have some special handling? Couldregexp
get that handling too?P.S. why does
fmt.Println(s)
return?