Git Product home page Git Product logo

beerio's Introduction

beerio

Blazingly faster alternative to cheerio.

Supported only on Bun runtime and cloudflare.

For a simple benchmark, beerio performs 2.6x faster than cheerio.

const $ = beerio.load(`<h2 class="title">Hello world</h2>`);
$("h2.title").text("hello");
$.html();

The above code was benchmarked in mitata for both the libraries.

cpu: 12th Gen Intel(R) Core(TM) i7-12700H
runtime: bun 1.0.26 (x64-linux)

benchmark      time (avg)             (min … max)
-------------------------------------------------
beerio      4,090 ns/iter   (3,653 ns … 6,347 ns)
cheerio     10.69 µs/iter   (7,683 ns … 1,866 µs)
  • How is beerio so fast?

    Beerio is a custom implementation of cheerio APIs by using underlying native HTMLRewriter to directly parse and manipulate the document quickly skipping both DOM parsing and rendering them back to HTML.

  • Is beerio a drop-in replacement for cheerio?

    Yes, but partially. Beerio is an alternative and does not strive to be a full drop-in replacement. Although Beerio APIs are kept consistent and similar to cheerio's but as there is no full DOM parsing, beerio is able to implement only a small portion of cheerio APIs.

Check out the full documentation here.

License

This repository uses MIT License. See LICENSE for full license text.

beerio's People

Contributors

tr1ckydev avatar

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.