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

perf: Avoid some unnecessary string copies #51

Merged
merged 1 commit into from Aug 16, 2020

Conversation

Gerrit0
Copy link
Contributor

@Gerrit0 Gerrit0 commented Aug 2, 2020

TypeDoc@future is using Shiki now for highlighting, and while profiling I noticed that >50% of the runtime in a moderately sized project was spent highlighting code comments. ~60% of this time was spent in node internals, which I deduced was the substring calls here.

Unfortunately, due to the existing API contract requiring that the same string be included several times, it isn't possible to completely eliminate this overhead... but I was able to reduce the runtime by ~20% by making these changes. There is still lots of room for improvement. I think the runtime can be cut in half if less information is returned (I don't need all that this gives... maybe I should just be using vscode-textmate directly)

@orta
Copy link
Contributor

orta commented Aug 8, 2020

👋🏻 if you can give this a rebase (so that CI runs) - I'm good to merge this, thanks!

@Gerrit0
Copy link
Contributor Author

Gerrit0 commented Aug 15, 2020

@orta rebased as requested.

@orta
Copy link
Contributor

orta commented Aug 16, 2020

rock, thanks

@orta orta merged commit a57fc35 into shikijs:master Aug 16, 2020
@orta orta mentioned this pull request Aug 16, 2020
octref added a commit that referenced this pull request Aug 20, 2020
antfu pushed a commit that referenced this pull request Jan 26, 2024
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

Successfully merging this pull request may close these issues.

None yet

2 participants