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

Avoid never used call to create empty string #11

Merged
merged 1 commit into from
Aug 1, 2023

Conversation

peter-scholtens
Copy link
Contributor

@peter-scholtens peter-scholtens commented Aug 1, 2023

As the function split() will create a vector with a length of at least 1 (see second example here), the case where length equals zero will never happen. I checked with the compiler explorer and this reduces function new() with 20 machine code instructions.

As the function split() will create a vector with a length of at least 1, the case where length equals zero will never happen.
@mike-engel mike-engel merged commit b907db5 into mike-engel:main Aug 1, 2023
6 checks passed
@mike-engel
Copy link
Owner

Thanks @peter-scholtens! Just curious, are you using this in embedded devices? You've been working on several optimizations that most computers probably don't need 😄

@peter-scholtens
Copy link
Contributor Author

I did hardware design in the past (mixed-signal silicon circuit design), so I prefer to make frugal usage of memory size and computation indeed :-)

@peter-scholtens peter-scholtens deleted the patch-2 branch August 1, 2023 09:07
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.

2 participants