Commit ab4ced1
committed
Time::HiRes add fast no dTHX; myNVtime() variant for CPAN XS devs (exprmt)
-TMHR has a fancy Perl maintained Win32 high precision GTOD() polyfill impl
inside it. But it can't be used for actual benchmarking by CPAN authors
b/c it's do a very slow Perl_get_context() call every time to get access
to MY_CXT struct. So add a pTHX_ version of myNVtime(). Add tests that
prove TMHR's C level public API for CPAN authors actually exists and
works. Nothing inside the P5P repo, ever tries to use TMHR's C level
Time::HiRes::myNVtime / Time::HiRes::myU2time function pointers.
-The 3 XSUBs for calling the TMHR C func ptrs, really should be in a
new .xs file inside ext/XS-APItest/ called "benchmark.xs" or
"noplgetcxt.xs" that has #define NO_PERL_GET_CONTEXT at the top, UNLIKE
all the other XS-APItest .xs files, which try to prove the very slot
ithreads-unaware CPAN XS legacy src code compat mode actually works.
-POK and SvPVX() store the 2nd fn ptr, in the same SV*, POK flag can be
used by CPAN XS authors to separate old TMHR releases w/o the new fn ptr
from new TMHR releases that have it. NOK and SvNVX() and using
union _xnvu {
NV xnv_nv;
HV * xgv_stash; <<<<<<<<
line_t xnv_lines;
bool xnv_bm_tail;
};
is an alternative design, but I went with POK and SvPVX, because even with
SvREADONLY(), I have paranoia, some C code on some OS on some CPU arch
somewhere, will do a random
read -> round_and_or_fire_IEEE_OS_signals -> write to SvNVX()
operation on the SvNVX() slot, for no good reason, b/c of
academic purity/standards body compliance/ABI requirements of
that CPU/OS arch, and the function ptr is now giberish, or was converted
from a denormal NaN to a normal NaN or SIG_DIV0-ed.
-future expansion provision exists, if SvPOK_on && SvCUR() > sizeof(void*),
SvPVX() is now a pointer to a C struct/C array, with the 1st 4/8 bytes
being a header, and not a fn ptr.
-TODO return by copy version of Time::U2time fn ptr, more efficient on
certain ABIs (__vectorcall/SysV) that allow 128 bit structs/arrays to
be returned in 2 registers back to the caller, and not secret pointers
as a secret 1st arg1 parent 87c3bfb commit ab4ced1
File tree
4 files changed
+175
-4
lines changed- dist/Time-HiRes
- ext/XS-APItest
- t
4 files changed
+175
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
671 | 671 | | |
672 | 672 | | |
673 | 673 | | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
674 | 678 | | |
675 | 679 | | |
676 | 680 | | |
677 | 681 | | |
678 | 682 | | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
679 | 686 | | |
680 | 687 | | |
681 | 688 | | |
682 | 689 | | |
683 | 690 | | |
684 | 691 | | |
685 | 692 | | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
686 | 706 | | |
687 | 707 | | |
688 | 708 | | |
| |||
1050 | 1070 | | |
1051 | 1071 | | |
1052 | 1072 | | |
1053 | | - | |
1054 | | - | |
1055 | | - | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
1056 | 1093 | | |
1057 | 1094 | | |
1058 | 1095 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1593 | 1593 | | |
1594 | 1594 | | |
1595 | 1595 | | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
1596 | 1711 | | |
1597 | 1712 | | |
1598 | 1713 | | |
| |||
1873 | 1988 | | |
1874 | 1989 | | |
1875 | 1990 | | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
1876 | 1996 | | |
1877 | 1997 | | |
1878 | 1998 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
150 | 151 | | |
151 | 152 | | |
152 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
153 | 167 | | |
154 | 168 | | |
0 commit comments