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

Fix escaping. #58

Merged
merged 6 commits into from
Jun 23, 2023
Merged

Fix escaping. #58

merged 6 commits into from
Jun 23, 2023

Conversation

davidlehn
Copy link
Member

  • Fix escaping and unescaping.
  • Support 8 hex char unicode.

NOTE: Escaping causes a serious performance regression with the initial version here. An optimization and benchmarks are forthcoming in another PR. This checkpoint is here for comparison and testing.

Tests available: w3c/rdf-canon#81

@@ -279,6 +301,7 @@ module.exports = class NQuads {
literal: TYPE_LITERAL
};

// FIXME escape
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: determine how to test this path and handle escaping as needed.

@dlongley
Copy link
Member

dlongley commented Mar 1, 2023

If there is a significant performance hit as you say, I think we will want to benchmark an option that does a quick scan for the need to escape control chars, etc. -- and only if it is needed does it run. Having such an option include that kind of information in the output as some meta data would also be helpful in the canonize algorithm because it could cause a switch in the comparator function as well (fast native string compare vs. explicit custom unicode code point compare).

Base automatically changed from update-benchmarking to main March 24, 2023 22:56
@codecov-commenter
Copy link

codecov-commenter commented Apr 1, 2023

Codecov Report

❗ No coverage uploaded for pull request base (main-with-3.4.0@788e0f5). Click here to learn what that means.
The diff coverage is n/a.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@                Coverage Diff                 @@
##             main-with-3.4.0      #58   +/-   ##
==================================================
  Coverage                   ?   90.09%           
==================================================
  Files                      ?       10           
  Lines                      ?      626           
  Branches                   ?        0           
==================================================
  Hits                       ?      564           
  Misses                     ?       62           
  Partials                   ?        0           

**BREAKING**: Use latest rdf-canon N-Quads canonical form. This can
change the canonical output! There is an expanded set of control
characters that are escaped as an `ECHAR` or `UCHAR` instead of using a
native representation.
- Use a pre-computed map of replacement values.
- Performance difference depends on the number of replacements. The
  rdf-canon escaping test showed up to 15% improvement.
@davidlehn
Copy link
Member Author

Merging to main staging branch along with the testing updates to have a testable base for other work.

@davidlehn davidlehn merged commit e4f57bc into main-with-3.4.0 Jun 23, 2023
7 checks passed
@davidlehn davidlehn deleted the fix-escaping branch June 23, 2023 03:55
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

3 participants