Coder Social home page Coder Social logo

kusstar / react-native-fast-url Goto Github PK

View Code? Open in Web Editor NEW
20.0 2.0 1.0 1.78 MB

A Fast URL and URLSearchParams Polyfills for React Native.

License: MIT License

CMake 0.06% C++ 94.34% Java 0.79% JavaScript 0.29% Ruby 0.33% C 0.06% Objective-C 0.21% Objective-C++ 0.12% Swift 0.01% TypeScript 3.79%
jsi polyfill react-native url urlsearchparams url-parser

react-native-fast-url's Introduction

react-native-fast-url

A Fast URL and URLSearchParams Polyfills for React Native.

Built in JSI and ada, a WHATWG-compliant and fast URL parser adopted in Node.js since v18.16 for the best performance.

Installation

npm install react-native-fast-url
yarn add react-native-fast-url

Benchmarks

Compared to react-native-url-polyfill.

Run on M1 Pro Mac Catalyst, React Native v0.72.7.

loop 100 loop 1,000 loop 10,000 loop 100,000
react-native-url-polyfill 22ms 125ms 1225ms 12438ms
react-native-fast-url 2ms 4ms 35ms 361ms
fast-url is 12x faster 35x faster 36x faster 34x faster

Benchmark code in example: bench.ts

This library(Ada) significantly outperforms react-native-url-polyfill in terms of speed, fully embracing the WHATWG URL standard and Unicode Standards. However, it's essential to note that Ada's bundle size is larger compared to react-native-url-polyfill. The binary size of the Ada C++ library is approximately 500KB, while react-native-url-polyfill is a more compact 73.67KB. The choice between the two should be based on your specific requirements and preferences.

Usage

Import the polyfill in your entry file:

// index.js
import 'react-native-fast-url/polyfill';

Or if you want to use it only in some files:

import { URL, URLSearchParams } from 'react-native-fast-url';

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

react-native-fast-url's People

Contributors

kusstar avatar zacmarion-cb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

zacharyfmarion

react-native-fast-url's Issues

Implementing setters + adding tests

Hey! Great project...fun fact I was halfway through implementing the exact same thing (using the same c++ library) when I realized it had already been done...great minds ๐Ÿ˜„. Just wanted to quickly check whether you would be okay with me putting up a PR to add support for all the setter methods and adding some unit tests that run in the example app (similar to here). I'm a bit hesitant to integrate this library at my company without any testing.

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.