NativeScript / android-dts-generator

A tool that generates TypeScript declaration files (.d.ts) from Jars
90 stars 23 forks source link

perf: make dts generation 60x faster by changing a regex #80

Closed mukaschultze closed 1 year ago

mukaschultze commented 1 year ago

The usedAsNonGenericPattern has a "Prefix" group that is not used for anything and contains a * modifier that is too broad and backtracks a lot. This perf improvement simply removes this matching group and leaves only the "Suffix" group which does not contain any backtracking modifiers.

This little change improves the DTS generation time from over 240 seconds down to only 4 seconds on my machine

I have tested this change on Android APIs from 30 to 34 and it generates the exact same output.

NathanWalker commented 1 year ago

Excellent @mukaschultze 👏