Skip to content

A high performance HTTP request router using Radix Tree

Notifications You must be signed in to change notification settings

shiyanhui/Router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Router

A high performance HTTP request router using Radix Tree inspired by httprouter

Features

  • Using binary search to find child to avoid worst O(n)
  • More detailed conflict information

C++ v Golang v Python

Match path /user/:name/:sex/:age Ten Million times:

  • Golang implementation cost about 2.7 seconds
  • C++ implementation cost about 3.7 seconds
  • Python implementation cost
    • CPython about 60 seconds
    • PyPy about 3.7 seconds

See router/tree/tree.go, router/tree/test_tree.cc and router/tree/test_tree.py for more details.

How to use it

Unlike Golang, the Python builtin libs have poor suport for http-server side. So you have to inherit router.BaseRouter for you own.

More

example/ contains several server-side simple examples.

License

The MIT License.

About

A high performance HTTP request router using Radix Tree

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published