gaborcsardi / parsedate

R package to parse dates given in arbitrary formats
65 stars 7 forks source link

parse_date is very slow on empty inputs #15

Closed Inventitech closed 7 years ago

Inventitech commented 7 years ago

The reason is that even if the input is "", parse_date does an exhaustive search of all its sub-functions to finally come up with the answer NA. This could be made much faster by doing the check up-front.

gaborcsardi commented 7 years ago

Well, I guess we could pre-check a bunch of different inputs..... but empty input is indeed a good candidate. Would you like to submit a PR?

gaborcsardi commented 7 years ago

Closed by #16

Inventitech commented 7 years ago

If you have ideas for which values to exclude other than the empty string -- please tell me. I was thinking of doing a trim on the values before and removing any non-alpha numeric chars.

gaborcsardi commented 7 years ago

TRimming is OK, but removing non-alphanumeric is not OK, because - and : might have meaning.

gaborcsardi commented 7 years ago

But the real solutions would be to rewrite the parser in C, actually.