smithy-lang / smithy-kotlin

Smithy code generator for Kotlin (in development)
Apache License 2.0
76 stars 26 forks source link

fix: optimize splitOnWordBoundaries #999

Closed aajtodd closed 8 months ago

aajtodd commented 8 months ago

Issue \

n/a

Description of changes

First pass at optimizing splitOnWordBoundaries which was refactored in #975. Avoids re-computation of "is start of word" when we already know it isn't the start of a word.

Follows after the similar Rust PR: https://github.com/smithy-lang/smithy-rs/pull/3140

Timings before and after for camel casing everything in all-names-test-output.csv:

// BEFORE
took 2634 milliseconds
took 1990 milliseconds
took 2211 milliseconds
took 1822 milliseconds
took 2038 milliseconds

// AFTER
took 487 milliseconds
took 392 milliseconds
took 353 milliseconds
took 352 milliseconds
took 346 milliseconds

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

sonarcloud[bot] commented 8 months ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication