[wp-trac] [WordPress Trac] #38537: Swap out md5 for base32 in feed ETag generation
WordPress Trac
noreply at wordpress.org
Fri Oct 28 00:44:08 UTC 2016
#38537: Swap out md5 for base32 in feed ETag generation
-------------------------+------------------------------
Reporter: geekysoft | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Feeds | Version: trunk
Severity: normal | Resolution:
Keywords: | Focuses:
-------------------------+------------------------------
Comment (by dd32):
I'd be fine with switching this, but the question I have is, what's the
benefit?
Having a reversible ETag doesn't seem to offer any benefit (nor does
having a irreversible ETag though) - an ETag doesn't need to be human
readable, just a unique single-phrase identifier for caching systems that
isn't going to collide.
Performance isn't a reason here, it's not executing __that__ often, and
even if it were, `md5()` is going to be 10x performant as the proposed
replacement here.
Out of curiosity I went ahead and benchmarked it, and it's nearly exactly
10x.. running 10,000 iterations of the two options here with `date('r')`
as the static input.. `md5: 0.00673s date: 0.07212s` If you use
`strtotime()` instead of `date_*` functions it's only 4x longer to execute
(`0.0274s`).
We're talking microseconds here, I've spent more time reading and
responding than this would save the average site in it's lifetime.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38537#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list