-
Notifications
You must be signed in to change notification settings - Fork 50
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
Rhai shortcodes: fixing performance issues #91
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some docs suggestions and then questions around escaping vs not escaping shortcodes.
Also, I'm not savvy on checking for performance as mentioned in the issue -- can @radu-matei advise/test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs and functionality LGTM!
I ran similar tests as mentioned in #56 (comment) against the Bartholomew docs site and noticed perhaps a slight decrease in performance, but I wouldn't say enough to block this feature. Thoughts @radu-matei ?
|
These results are pretty close to what I have. There is some contribution to the decrease in performance due to this branch having an extra page in A catch with this is that the more pages that use shortcodes, the slower the rendering time will be. It is because currently, we render every page on every request. Therefore the number of content pages we have will have an impact on the performance metrics. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few comments, but nothing major.
Re: performance, the fact that we need to render the additional shortcode does make sense, so I wouldn't be worried by the additional latency here — particularly because you're not incurring it unless you are actively using them.
See below:
$ bombardier -n 100 -c 1 http://localhost:3000/shortcodes
Bombarding http://localhost:3000/shortcodes with 100 request(s) using 1 connection(s)
Done!
Statistics Avg Stdev Max
Reqs/sec 193.15 33.53 244.26
Latency 5.18ms 1.09ms 14.69ms
HTTP codes:
1xx - 0, 2xx - 100, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 4.96MB/s
$ bombardier -n 100 -c 1 http://localhost:3000/shortcodes
Bombarding http://localhost:3000/shortcodes with 100 request(s) using 1 connection(s)
Done!
Statistics Avg Stdev Max
Reqs/sec 247.07 48.25 305.95
Latency 4.07ms 1.06ms 13.19ms
HTTP codes:
1xx - 0, 2xx - 100, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 6.02MB/s
Happy to do another pass at this once you address the comments.
Thanks!
The last commit you pushed appears as unverified. Thanks! |
I am sorry about the last commit being unverified. There was a mess up on my part switching emails. Would you recommend that I squash the commits in this PR? |
Yeah, rebasing and squashing the unnecessary commits makes sense. |
Signed-off-by: Karthik Ganeshram <karthik.ganeshram@fermyon.com>
baafd7f
to
24dec4c
Compare
It looks like this is ready to go! Defer to @radu-matei who had the most recent requested changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thank you for this great feature @karthik2804! |
Adapting #56 to include Rhai shortcodes support for markdown content. Adds a new page head field
enable_shortcodes
. It does not introduce a significant performance hit as it only runs the markdown content with the shortcode switch through handlebars before the markdown parser.