Use standard library functions where possible#215
Open
jeroenvandijk wants to merge 3 commits intoweavejester:masterfrom
Open
Use standard library functions where possible#215jeroenvandijk wants to merge 3 commits intoweavejester:masterfrom
jeroenvandijk wants to merge 3 commits intoweavejester:masterfrom
Conversation
Tests fail if I don't keep the or
jeroenvandijk
referenced
this pull request
Oct 14, 2024
It was possible for the macros to generate so much bytecode that they would exceed Java's 64KB limit for method code size. In such situations the Clojure compiler would fail with the message "Method code too large!" See #205 This commit does the following optimizations: 1. Concatenate string literals at compile time, so that we can replace multiple StringBuilder.append() calls with just one. This reduces the generated code from O(n) to O(1). This also improves performance by 10-20%, since copying one long string is faster than many short strings. 2. When a runtime check is needed to determine whether a value is the element's attribute map or its first child element, avoid duplicating the code for the element's content. This reduces the generated code from O(n^2) to O(n). While improving the test coverage, some edge cases of generating bad HTML were detected. This commit doesn't change the existing behavior, but only documents it in the new tests. Fixing that behavior will be done in future commits.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit removes some unnecessary interop and make it easier to use hiccup from other environments (like Sci)
.substringtosubs.indexOftoclojure.string/index-of(with backwards compatibility for older clojure versions <1.8)String/valueOf withstr(reasoning here)It is a first step towards resolving issues #184 and #127
I've left the StringBuilder interop for now, as it might have performance benefits and a (good) patch would be more involved.