Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add date field check #169

Merged
merged 10 commits into from
Jul 19, 2016
Merged

Add date field check #169

merged 10 commits into from
Jul 19, 2016

Conversation

olorin
Copy link
Contributor

@olorin olorin commented Jul 18, 2016

Add basic "does this look like a date/datetime" check.

Working towards #113. No behavioural changes in warden yet, just adding groundwork.

@thumphries @erikd-ambiata

∃ ./dist/build/bench/bench field-parsing
benchmarking field-parsing/parseField/200
time                 24.51 μs   (23.52 μs .. 25.59 μs)
                     0.987 R²   (0.974 R² .. 0.997 R²)
mean                 24.22 μs   (23.72 μs .. 25.01 μs)
std dev              2.359 μs   (1.484 μs .. 3.796 μs)
variance introduced by outliers: 84% (severely inflated)

benchmarking field-parsing/checkFieldBool/boolean/100
time                 8.392 μs   (8.310 μs .. 8.512 μs)
                     0.997 R²   (0.993 R² .. 1.000 R²)
mean                 8.567 μs   (8.377 μs .. 9.339 μs)
std dev              1.112 μs   (394.4 ns .. 2.203 μs)
variance introduced by outliers: 92% (severely inflated)

benchmarking field-parsing/checkFieldBool/non-boolean/100
time                 7.005 μs   (6.849 μs .. 7.159 μs)
                     0.994 R²   (0.986 R² .. 0.998 R²)
mean                 7.108 μs   (6.928 μs .. 7.554 μs)
std dev              1.014 μs   (470.5 ns .. 1.908 μs)
variance introduced by outliers: 93% (severely inflated)

benchmarking field-parsing/checkFieldDate/date/100
time                 6.978 μs   (6.817 μs .. 7.140 μs)
                     0.993 R²   (0.983 R² .. 0.999 R²)
mean                 7.151 μs   (6.909 μs .. 7.941 μs)
std dev              1.372 μs   (253.3 ns .. 2.830 μs)
variance introduced by outliers: 96% (severely inflated)

benchmarking field-parsing/checkFieldDate/non-date/100
time                 10.55 μs   (9.938 μs .. 10.91 μs)
                     0.978 R²   (0.968 R² .. 0.986 R²)
mean                 8.945 μs   (8.446 μs .. 9.506 μs)
std dev              1.679 μs   (1.476 μs .. 1.863 μs)
variance introduced by outliers: 96% (severely inflated)

@thumphries
Copy link

🎋

@olorin olorin force-pushed the topic/date branch 2 times, most recently from 3b7136d to 9fa8b76 Compare July 19, 2016 00:58

precondition: n >= 8 */
static inline bool match_ymd(char *buf, size_t n) {
/* 0xc0 = 0x80 | 0x40 - if these bits are set, the byte is too

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably want to make that const char * buf unless you intend to modify it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, thanks.

@erikd-ambiata
Copy link

Apart from a couple of places where parameters should be passed as const char* instead of char* and the idea of pulling the pre-condition test inside the function that requires it, 💯 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants