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

Improving rendering performance #92

Closed
karthik2804 opened this issue Jul 26, 2022 · 2 comments
Closed

Improving rendering performance #92

karthik2804 opened this issue Jul 26, 2022 · 2 comments

Comments

@karthik2804
Copy link
Contributor

While working on #91, I noticed that the content body of every .md file is parsed on every request. This induces a potential performance hit. I feel like this could be an area for performance optimization of the rendering process as I think it is unnecessary to parse the markdown content of files other than the one that is requested. The required details for the post can be obtained from the header.

I realize that this would disrupt the way in which the posts in a blog would be listed where the content appears below the title but I feel like it is a problem that can be solved by using the description in the head. One compromise would be to only parse the markdown if the head.description is empty.

Any thoughts?

@karthik2804 karthik2804 changed the title Improving performance Improving rendering performance Jul 26, 2022
@karthik2804
Copy link
Contributor Author

Based on some experimentation not running the body of every article through the markdown parser seems to make a significant difference in the performance.
With parsing the markdown content

bombardier -c 1 -n 1000 http://localhost:3000/
Bombarding http://localhost:3000/ with 1000 request(s) using 1 connection(s)
 1000 / 1000 [========================================================================================================================================================] 100.00% 41/s 24s
Done!
Statistics        Avg      Stdev        Max
  Reqs/sec        41.47       8.38     117.03
  Latency       24.14ms     3.74ms    41.19ms
  HTTP codes:
    1xx - 0, 2xx - 1000, 3xx - 0, 4xx - 0, 5xx - 0
    others - 0
  Throughput:     1.47MB/s

Without parsing the markdown content

bombardier -c 1 -n 1000 http://localhost:3000/
Bombarding http://localhost:3000/ with 1000 request(s) using 1 connection(s)
 1000 / 1000 [========================================================================================================================================================] 100.00% 65/s 15s
Done!
Statistics        Avg      Stdev        Max
  Reqs/sec        66.26      23.45     105.03
  Latency       15.09ms   621.28us    20.05ms
  HTTP codes:
    1xx - 0, 2xx - 1000, 3xx - 0, 4xx - 0, 5xx - 0
    others - 0
  Throughput:     2.29MB/s

Also, an added benefit of not parsing the markdown content is that once the rhai shortcodes #91 gets merged, the performance of pages that don't use shortcodes will not incur a performance penalty due to other pages utilizing shortcodes.

@karthik2804
Copy link
Contributor Author

Closed by #103 and associated PR #104.

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

No branches or pull requests

1 participant