This repository was archived by the owner on Jan 21, 2026. It is now read-only.
handle_in_body: Replaced if/else-if with switch/case stmt#370
Open
sebcat wants to merge 1 commit intogoogle:masterfrom
Open
handle_in_body: Replaced if/else-if with switch/case stmt#370sebcat wants to merge 1 commit intogoogle:masterfrom
sebcat wants to merge 1 commit intogoogle:masterfrom
Conversation
gprof on benchmark before change: Flat profile: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls ms/call ms/call name 12.15 0.57 0.57 38932310 0.00 0.00 handle_in_body 8.10 0.95 0.38 45036450 0.00 0.00 gumbo_lex 6.82 1.27 0.32 gumbo_parse_with_options 6.61 1.58 0.31 98682890 0.00 0.00 read_char 5.33 1.83 0.25 92378210 0.00 0.00 gumbo_string_buffer_append_codepoint 5.33 2.08 0.25 45037230 0.00 0.00 abandon_current_tag 3.20 2.23 0.15 92378210 0.00 0.00 maybe_resize_string_buffer 2.99 2.37 0.14 98676780 0.00 0.00 utf8_is_invalid_code_point 2.77 2.50 0.13 37336260 0.00 0.00 reconstruct_active_formatting_elements 2.56 2.62 0.12 59399950 0.00 0.00 maybe_emit_from_temporary_buffer gprof on benchmark after change: Flat profile: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls ms/call ms/call name 8.41 0.35 0.35 gumbo_parse_with_options 7.21 0.65 0.30 45036450 0.00 0.00 gumbo_lex 6.73 0.93 0.28 98682890 0.00 0.00 read_char 4.57 1.12 0.19 98676780 0.00 0.00 utf8_is_invalid_code_point 4.33 1.30 0.18 92378210 0.00 0.00 gumbo_string_buffer_append_codepoint 4.09 1.47 0.17 45037230 0.00 0.00 abandon_current_tag 3.61 1.62 0.15 98670910 0.00 0.00 utf8iterator_next 3.49 1.77 0.15 38932310 0.00 0.00 handle_in_body 3.13 1.90 0.13 42229930 0.00 0.00 emit_char 2.88 2.02 0.12 99583440 0.00 0.00 parser_add_parse_error
Contributor
|
Thanks for the patch! Nice speedup. The Travis CI is failing for what appears to be an unrelated reason - it can't fetch the gtest distribution, which has been moved off of GoogleCode and is now on GitHub. I should fix that in a separate change - it could be replaced by a subinclude now that GTest is on Git - but for now I'll take your word that you ran all the tests and they passed. |
nostrademons
approved these changes
Sep 30, 2016
Contributor
|
Oh hmm, apparently I can't merge because I'm no longer a member of the Google organization (I haven't worked there in 2 years now). Any other Googlers still paying attention to this? I'd be quite open to transferring maintainership to someone else as well, since I've rarely had time to give this library the attention it deserves. |
kovidgoyal
added a commit
to kovidgoyal/html5-parser
that referenced
this pull request
Jul 25, 2017
Replace giant if/elif by switch() See google/gumbo-parser#370
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CLA signed. Ran clang-format on src/parser.c. Compared prettyprint serializations of benchmarks/*.html, output from prettyprint on master and modified branch were identical (same sha1sum output). Ran make check: