[wp-trac] [WordPress Trac] #61170: Interactivity API: Improve JSON store serialization
WordPress Trac
noreply at wordpress.org
Wed May 15 19:40:11 UTC 2024
#61170: Interactivity API: Improve JSON store serialization
-------------------------------+--------------------------------------
Reporter: jonsurrell | Owner: jonsurrell
Type: enhancement | Status: closed
Priority: normal | Milestone: 6.6
Component: Interactivity API | Version: 6.5
Severity: normal | Resolution: fixed
Keywords: has-patch | Focuses: javascript, performance
-------------------------------+--------------------------------------
Comment (by dmsnell):
Thanks @TobiasBg! It was originally like this, but I rearranged it
intentionally to streamline the UTF-8 case, and to signify that UTF-8
//is// and //should be// normative. (We can observe that if the blog
charset is not UTF-8 then there's no computation, but in the normative
case when it //is// UTF-8 we would have to perform additional computation
the way you propose).
Note too that it may not be the case that it's micro-optimized faster. the
`|=` adds a data-dependency that cannot be pre-computed by the CPU in the
same way that alternate assignment could. I think it's highly likely that
there is no measurable or meaningful optimization here, so unless we have
evidence otherwise (outside of any synthetic micro-benchmarks) it would be
best to focus on the nuance.
I'm not worried about duplication either, because it's just a couple of
integer flags. I could see comprehension being better in each case, so the
tradeoff is perhaps subjective. I like seeing the full set in each case so
I don't have to track the execution in my head.
What do you think?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61170#comment:29>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list