Continue porting period_helper to cython
State: closed

This moves functions to cython but retains their C names to make comparison easier.  The next pass will get rid of the camelCase.  A couple of redundant functions are left behind in period_helper, will be cleaned up in a follow-up.

The next hurdle is to get rid of all the adding and subtracting of ORD_OFFSET, WEEK_OFFSET, BDAY_OFFSET.  (The period_helper code puts 0 at Jan 1 0001 instead of Jan 1 1970).  This would be straightforward but I want to be careful about C division/mod conventions.

Labels:
name: Period
description: Period data type
name: Clean

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19608?src=pr&el=h1) Report
> Merging [#19608](https://codecov.io/gh/pandas-dev/pandas/pull/19608?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/b83512773ab0dd3908cf2ef5ccaddcd8e0337c64?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/19608/graphs/tree.svg?width=650&height=150&src=pr&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/19608?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #19608      +/-   ##
==========================================
- Coverage   91.62%   91.61%   -0.01%     
==========================================
  Files         150      150              
  Lines       48790    48790              
==========================================
- Hits        44703    44701       -2     
- Misses       4087     4089       +2
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.99% <ø> (-0.01%)` | :arrow_down: |
| #single | `41.73% <ø> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/19608?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/19608/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `83.64% <0%> (-0.21%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19608?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19608?src=pr&el=footer). Last update [b835127...769feee](https://codecov.io/gh/pandas-dev/pandas/pull/19608?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

```
taskset 5 asv continuous -f 1.1 -E virtualenv master HEAD -b period -b period -b timeseries
[...]
   before     after       ratio
  [b8351277] [769feee1]
+   19.37μs    23.65μs      1.22  period.PeriodUnaryMethods.time_now('M')
+    2.01ms     2.40ms      1.19  timeseries.ResampleSeries.time_resample('period', '5min', 'mean')
+  133.42ms   154.58ms      1.16  timeseries.DatetimeIndex.time_to_pydatetime('tz_aware')
+    7.40μs     8.44μs      1.14  timeseries.AsOf.time_asof_single_early('Series')
+    2.38ms     2.71ms      1.14  timeseries.ResampleSeries.time_resample('period', '5min', 'ohlc')
+    4.27μs     4.79μs      1.12  timeseries.DatetimeIndex.time_get('dst')
+    2.46ms     2.76ms      1.12  timeseries.ToDatetimeCache.time_dup_seconds_and_unit(False)
-    4.53μs     4.04μs      0.89  timeseries.DatetimeIndex.time_get('tz_naive')
-   71.76μs    63.44μs      0.88  period.PeriodProperties.time_property('M', 'start_time')
-    3.16μs     2.72μs      0.86  timeseries.DatetimeIndex.time_get('repeated')

    before     after       ratio
  [b8351277] [769feee1]
+   20.97ms    25.91ms      1.24  timeseries.IrregularOps.time_add
+  886.50ns     1.01μs      1.14  period.PeriodProperties.time_property('min', 'dayofweek')
+   18.87μs    20.96μs      1.11  period.PeriodUnaryMethods.time_asfreq('M')
-   19.24μs    17.26μs      0.90  timeseries.AsOf.time_asof_single('Series')
-    4.06ms     3.64ms      0.90  timeseries.ToDatetimeISO8601.time_iso8601_nosep
-  962.36ns   852.72ns      0.89  period.PeriodProperties.time_property('min', 'dayofyear')
-  153.68ms   128.59ms      0.84  timeseries.DatetimeIndex.time_to_pydatetime('tz_aware')
-   24.75μs    20.10μs      0.81  period.PeriodUnaryMethods.time_now('M')
```