FAQ
What does this program do?
Given a user-input string ("needle"), perform a fuzzy search on a set of strings ("haystack"s) extracted from the draft versions of the C++ standard. The results are sorted by insert-substitute-delete distance from the "needle". The search time depends only on the length of the needle, and is independent of the number or length of the haystacks.
Total size of "haystack"s: 35680169B.
Size of "the index": 85077149B.
Number of "the index" bytes per "haystack" byte: 2.384437949.
What doesn't this program do?
The program only searches the C++ standard, not the C standard. Searching for "printf" or "fopen" yields no useful results.
The program only searches the text, not the semantics. For example, if you want to know the last C++ standard that supports one's complement representation of integers, you might search for "one's complement", but the exact wording is "1's complement".
Which strings are indexed as "haystack"s, and which are not?
"Haystack"s include:
term of index items (e.g. "pack expansion");
section number (e.g. "4.1", "Annex D (normative)");
section title (e.g. "Implementation compliance", "Compatibility features");
section abbreviation (e.g. "[intro.compliance]", "[depr]");
text of body text (e.g. "Although this document states only requirements on C++ implementations, those requirements are often easier to understand if they are phrased as requirements on programs, parts of programs, or execution of programs. Such requirements have the following meaning:");
text of footnote (e.g. "“Correct execution” can include undefined behavior and erroneous behavior, depending on the data being processed; see [intro.defs] and [intro.execution].").
"Haystack"s don't include:
href of any links;
text of link of index items (e.g. "[temp.variadic]");
number of body text (e.g. "1", "(2.3.1)");
number of footnote (e.g. "3)").
How to search for non-plain-text content, such as math formula and images?
Math formula are replaced by their Node: textContent property (not HTMLElement: innerText property to avoid unwanted "\n"s) before going into "the index".
"^" is inserted before each superscript and "_" is inserted before each subscript. For example, search for "P_ℓ^m" instead of "Pℓm", "T_j" instead of "Tj".
Images are replaced by their HTMLImageElement: alt property before going into "the index". For example, search for "\frac" or "\sum".
How to save a search? / How to create a link to a search?
The query parameters q, filter_standard_version and filter_result_type can be used to control the "needle" and the settings, e.g. https://jhcarl0814.github.io/cpp_working_drafts/cpp_working_drafts.html?filter_standard_version=N3337,N4140,N4618,N4659,N4861,N4868,N4950,working_draft&filter_result_type=index_item_term,section_number,section_title,section_abbreviation,body_text_content,footnote_content&q=to_underlying.
If either filter_standard_version or filter_result_type appears in the query parameters, the remaining settings will be set to their default values instead of using the local settings.
Visiting links that contain query parameters that affect settings will never modify local settings. Local settings are only modified when the user interacts with form controls.
Why is the webpage lagging?
Currently the time consumed by the program can be divided into these parts:
C++ (compiled to Wasm):
Searching (u8"needle" -> { haystack_index }) takes 0.0~0.2s.
Formatting ({ haystack_index } -> u8"html") takes ~0.05s.
Browser:
Ideally the time consumed by the program should be divided into these parts:
C++ (compiled to Wasm):
Searching (u8"needle" -> { haystack_index }) takes 0.0~0.2s.
Manipulating DOM ({ haystack_index } -> operations on DOM).
Browser:
See Why is WebAssembly a second-class language on the web? - Mozilla Hacks - the Web developer blog.