Git Product home page Git Product logo

Comments (1)

dan1wang avatar dan1wang commented on July 26, 2024

I did a complete re-write of the named-entity decoder: https://github.com/dan1wang/node-html-entities/tree/rewrite

Here is bench mark result

    XmlEntities.decode: 41ms, 244op/msec
    Html4Entities.decode: 59ms, 169op/msec
    html5Entities.decode: 57ms, 175op/msec
    nodeHtmlEncoder(entities).htmlDecode: 841ms, 12op/msec
    nodeHtmlEncoder(numerical).htmlDecode: 830ms, 12op/msec
    entities.decodeXML: 30ms, 333op/msec
    entities.decodeHTML4: 52ms, 192op/msec
    entities.decodeHTML5: 43ms, 233op/msec
    newDecoder.decodeHTML4Entities: 47ms, 213op/msec
    newDecoder.decodeHTML5Entities: 110ms, 91op/msec
    newDecoder.decodeHTML4EntitiesStrict: 26ms, 385op/msec
    newDecoder.decodeHTML5EntitiesStrict: 32ms, 313op/msec

For non-strict decoding, the new HTML5 entity decoder is the slowest of all. This is because if you make semi-colon optional, you have to start trying to match the longest named entities first, and there are lots of entities to cover.

For strict decoding, the new decoder is lightning fast :-)

The code is incomplete (doesn't do numerical decoding yet).

The code should be changed to do String.split('&') first. That will speed things up considerably.

from html-entities.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.