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

Return empty string if argument is an empty hash #665

Merged
merged 1 commit into from May 14, 2020

Conversation

ashmaroli
Copy link
Contributor

When attr == {}, then end result to Kramdown::Utils::Html#html_attributes(attr) is always "", but involves allocation of intermediate empty array and the returned new empty string.

These allocations can be eliminated by returning a single frozen string every time attr is an empty hash.

@gettalong gettalong merged commit fc910f9 into gettalong:master May 14, 2020
@gettalong
Copy link
Owner

Thanks!

@ashmaroli ashmaroli deleted the empty-html-attributes branch May 15, 2020 07:01
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