serenity icon indicating copy to clipboard operation
serenity copied to clipboard

LibGfx/JPEGLoader: Check earlier for huffman tables presence

Open LucasChollet opened this issue 1 year ago • 2 comments

We now check the table presence only once per scan instead of once per component value. This makes the 3% spent in compute_sip_hash() disappear.

LucasChollet avatar Feb 26 '24 20:02 LucasChollet

LG! This is much nicer than before imho :)

From a functionnal point of view I can only agree, spending any time in the hash computation is inadmissible. I wonder if it's a regression, as I don't remember seeing that in a profile. I'm still not a huge fan of having two Arrays though, it really looks like a handrolled Array<Optional<>> to my eyes.

(very nit: I'd probably find "has_ac_table" more readable than "registered_ac_table", but :hypeshed:)

Too late! Let's stay consistent with registered_quantization_tables.

LucasChollet avatar Feb 27 '24 02:02 LucasChollet

The table array type will become public API for people to pass in fata, and the public API doesn't need the ability to pass in optionals. That's only needed when reading from the file. (Which also makes the struct not work.)

nico avatar Feb 27 '24 23:02 nico

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

stale[bot] avatar Mar 20 '24 05:03 stale[bot]

This pull request has been closed because it has not had recent activity. Feel free to re-open if you wish to still contribute these changes. Thank you for your contributions!

stale[bot] avatar Mar 31 '24 18:03 stale[bot]