Giter VIP home page Giter VIP logo

ruby-uriparser's Introduction

ruby-uriparser

Gem Version

Ruby-uriparser is a wrapper for uriparser C library which is fast (linear input length time complexity), approximatelly 7.5x faster than the standard ruby URI library with a low memory consumption.

It is a fairly reasonable hypothesis to consider that all Ruby Rack applications will call, at least once, the URI.parse method for each http request, so this simple optimization can bring a significant impact on a high load environment. (See Benchmark)

Usage

require 'uriparser'

UriParser.parse('https://localhost:9000/path/?a=1#x') # return UriParser::URI object

If you want to override the URI class just include the following line in your code:

# Will override URI#parse and Kernel#URI methods
require 'uriparser/uri_gem'

Benchmark

The following numbers were computed for 100,000 URI.parse calls using the ruby benchmark library in a Mac OS X (10.8.5)/ 2.9Ghz Intel Core I5/ 8GB 1600 MHz DDR3 machine:

Rehearsal ------------------------------------------------
URI            0.750000   0.000000   0.750000 (  0.750619)
UriParser      0.110000   0.010000   0.120000 (  0.111885)
Addressable    1.880000   0.000000   1.880000 (  1.886091)
--------------------------------------- total: 2.750000sec

                   user     system      total        real
URI            0.730000   0.000000   0.730000 (  0.728169)
UriParser      0.110000   0.000000   0.110000 (  0.107235)
Addressable    1.870000   0.000000   1.870000 (  1.863334)

Installation

gem install ruby-uriparser

External dependencies

The ruby-uriparser gems needs the library uriparser installed to compile.

See the availables ports list: http://uriparser.sourceforge.net/#ports.

If you are on Mac OS X just run brew install uriparser.

License

This project is released under the MIT license (See LICENSE file).

Copyright (c) 2014 Thiago Lewin - http://github.com/tlewin

Third party libraries

This project includes code from the New BSD licensed:

All rights reserved.

ruby-uriparser's People

Contributors

tlewin avatar

Stargazers

 avatar

Watchers

 avatar  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.