Skip to content

Significant performance improvements#1308

Merged
Perryvw merged 26 commits intoTypeScriptToLua:masterfrom
GlassBricks:optimize
Jul 18, 2022
Merged

Significant performance improvements#1308
Perryvw merged 26 commits intoTypeScriptToLua:masterfrom
GlassBricks:optimize

Conversation

@GlassBricks
Copy link
Copy Markdown
Contributor

@GlassBricks GlassBricks commented Jul 16, 2022

When benchmarking with isaccscript-common using cli, nearly halves the total time, and improves transpilation time (time spent in transformSourceFile by a factor of 5.

The most improvement was from changing checking for language-extensions from O(total number of extensions) to O(1) (which is checked at every identifier and call expression!) To do this, language extensions were separated into separate categories (__tstlExtension, __tstlIterable, and __tstlMultiReturn), and extension type is checked by reading the string literal value of the extension property (except for __tstlMultiReturn).

This rewrites/re-structures language extension calls and builtin calls, and cleans up some code/bugs found along the way.

Annotations that were deprecated have now been completely removed from being checked.

@Zamiell
Copy link
Copy Markdown
Contributor

Zamiell commented Jul 16, 2022

Amazing!!!

@Perryvw Perryvw requested a review from tomblind July 16, 2022 09:06
Copy link
Copy Markdown
Member

@Perryvw Perryvw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would have preferred if this had come in smaller incremental PRs. There are a lot of different improvement ideas mixed together now which makes it much harder to review...

I reviewed most of this but skipped some parts that seemed not finished yet. Also resolve needs a further very careful look.

6% transpilation time speedup
typeToTypeNode is very slow
@GlassBricks GlassBricks requested a review from Perryvw July 16, 2022 18:15
Copy link
Copy Markdown
Member

@Perryvw Perryvw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the benchmark failing, mismatch of language extensions between master and your branch?

@GlassBricks
Copy link
Copy Markdown
Contributor Author

GlassBricks commented Jul 17, 2022

Why is the benchmark failing, mismatch of language extensions between master and your branch?

The benchmark is using an old version of language-extensions, so MultiReturn is not being detected. This is due to the lua-types package depending on a older version of tstl (for type definitions, not compilation). A somewhat hacky workaround I found was to add "typescript-to-lua": "file:." to devDependencies, but I don't think we should include that.

@GlassBricks GlassBricks requested a review from Perryvw July 17, 2022 18:07
@GlassBricks GlassBricks requested a review from Perryvw July 18, 2022 00:47
@Perryvw Perryvw merged commit cfd1e36 into TypeScriptToLua:master Jul 18, 2022
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.

3 participants