-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix performance issue caused by using repeated
>
characters inside …
…`CDATA [ PAYLOAD ]` (#172) A `<` is treated as a string delimiter. In certain cases, if `<` is used in succession, read and match are repeated, which slows down the process. Therefore, the following is used to read ahead to a specific part of the string in advance.
- Loading branch information
1 parent
c1b64c1
commit 9f1415a
Showing
2 changed files
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require "test/unit" | ||
require "core_assertions" | ||
|
||
require "rexml/document" | ||
|
||
module REXMLTests | ||
class TestParseCData < Test::Unit::TestCase | ||
include Test::Unit::CoreAssertions | ||
|
||
def test_gt_linear_performance | ||
seq = [10000, 50000, 100000, 150000, 200000] | ||
assert_linear_performance(seq, rehearsal: 10) do |n| | ||
REXML::Document.new('<description><![CDATA[ ' + ">" * n + ' ]]></description>') | ||
end | ||
end | ||
end | ||
end |