Print set-digest hit ratio with HB_DEBUG_SET_DIGESTS
This commit is contained in:
parent
1357c2dd12
commit
4d2813d3e9
@ -102,6 +102,10 @@ struct hb_set_digest_lowest_bits_t
|
|||||||
mask_t mask;
|
mask_t mask;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef HB_DEBUG_SET_DIGESTS
|
||||||
|
extern unsigned long digest_total, digest_yes, digest_yes1, digest_yes2;
|
||||||
|
#endif
|
||||||
|
|
||||||
struct hb_set_digest_t
|
struct hb_set_digest_t
|
||||||
{
|
{
|
||||||
ASSERT_POD ();
|
ASSERT_POD ();
|
||||||
@ -122,6 +126,15 @@ struct hb_set_digest_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline bool may_have (hb_codepoint_t g) const {
|
inline bool may_have (hb_codepoint_t g) const {
|
||||||
|
#ifdef HB_DEBUG_SET_DIGESTS
|
||||||
|
digest_total++;
|
||||||
|
if (digest1.may_have (g) && digest2.may_have (g))
|
||||||
|
digest_yes++;
|
||||||
|
if (digest1.may_have (g))
|
||||||
|
digest_yes1++;
|
||||||
|
if (digest2.may_have (g))
|
||||||
|
digest_yes2++;
|
||||||
|
#endif
|
||||||
return digest1.may_have (g) && digest2.may_have (g);
|
return digest1.may_have (g) && digest2.may_have (g);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,19 @@
|
|||||||
#include "hb-set-private.hh"
|
#include "hb-set-private.hh"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HB_DEBUG_SET_DIGESTS
|
||||||
|
unsigned long digest_total, digest_yes, digest_yes1, digest_yes2;
|
||||||
|
__attribute__((__destructor__))
|
||||||
|
void digest_print (void)
|
||||||
|
{
|
||||||
|
if (!digest_total)
|
||||||
|
return;
|
||||||
|
printf("Set digest summary: both %%%ld first %%%ld second %%%ld\n",
|
||||||
|
100 * digest_yes / digest_total,
|
||||||
|
100 * digest_yes1 / digest_total,
|
||||||
|
100 * digest_yes2 / digest_total);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Public API */
|
/* Public API */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user