Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache constant into_v32 calls #5

Open
Tracked by #6
baehyunsol opened this issue Jun 6, 2023 · 3 comments
Open
Tracked by #6

Cache constant into_v32 calls #5

baehyunsol opened this issue Jun 6, 2023 · 3 comments
Labels
performance performance optimization

Comments

@baehyunsol
Copy link
Owner

No description provided.

@baehyunsol baehyunsol added the performance performance optimization label Jun 6, 2023
@baehyunsol
Copy link
Owner Author

Don't cache everything: cache only frequently used string slices.

Make into_v32 print it's arguments and render the reference MDxt: collect string slices that are used more than 5 times and length is longer than 5!

@baehyunsol
Copy link
Owner Author

For gigantic branches like below,

if op == into_v32(...) {...}

else if op == into_v32(...) {...}

else if op == into_v32(...) {...}

// ... hundreds more

use another algorithm (eg: FSM)

@baehyunsol
Copy link
Owner Author

Below table shows repetitive into_v32 calls when rendering the reference file (eg: into_v32("math") is called 173 times).

String Count
"&<>\"'" 2703
"math" 173
"</span></span>\n" 172
"<span class=\"code-fence-row\">" 169
"</span>" 155
"<span class=\"code-fence-code\">" 149
"</code>" 113
"<code class=\"inline-code-span\">" 95
"</td>" 89
"<td>" 88
"\">" 83
"</li>" 83
"</p>" 73
"<p>" 73
"<span class=\"color-white\">" 69
"<li>" 68
"1." 65
"</a>" 58
"<a href=\"" 58
"\n" 52
">" 51
"#" 51
" " 48
"\"" 48
" id=\"" 47
"](#" 46
"- " 46
"[" 46
")" 46
"/" 39
"</tr>" 38
"<tr>" 38
"" 37
"a" 36
"<h3" 32
"</h3>" 32
"<>*~[|]^`&" 29
"A" 29
"I" 29
"i" 29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance performance optimization
Projects
None yet
Development

No branches or pull requests

1 participant