Append benchmark result
This commit is contained in:
parent
85be3b4dfa
commit
184770358a
1 changed files with 21 additions and 4 deletions
25
README.md
25
README.md
|
@ -1,15 +1,14 @@
|
||||||
R3
|
R3
|
||||||
================
|
================
|
||||||
|
|
||||||
R3 is an URI router library. It compiles your route paths into a radix tree.
|
R3 is an URI router library. It compiles your route paths into a prefix trie.
|
||||||
By using the constructed radix tree in the start-up time, you may dispatch your
|
By using the constructed prefix trie in the start-up time, so you can dispatch
|
||||||
routes efficiently.
|
routes with efficiency.
|
||||||
|
|
||||||
Pattern Syntax
|
Pattern Syntax
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
/blog/post/{id} use [^/]+ regular expression by default.
|
/blog/post/{id} use [^/]+ regular expression by default.
|
||||||
|
|
||||||
/blog/post/{id:\d+} use `\d+` regular expression instead of default.
|
/blog/post/{id:\d+} use `\d+` regular expression instead of default.
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,6 +42,24 @@ int ret = *( (*int) matched_node->route_ptr );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Benchmark
|
||||||
|
-----------------------
|
||||||
|
The routing benchmark from stevegraham/rails' PR <https://github.com/stevegraham/rails/pull/1>:
|
||||||
|
|
||||||
|
omg 10462.0 (±6.7%) i/s - 52417 in 5.030416s
|
||||||
|
|
||||||
|
And here is the result of the router journey:
|
||||||
|
|
||||||
|
omg 9932.9 (±4.8%) i/s - 49873 in 5.033452s
|
||||||
|
|
||||||
|
r3 uses the same route path data for benchmarking, and here is the benchmark:
|
||||||
|
|
||||||
|
5000000 iterations finished in 0.905591 seconds
|
||||||
|
5521256.22 i/sec
|
||||||
|
|
||||||
|
The matching speed of r3 is 527+ times faster than rails' trie router.
|
||||||
|
|
||||||
|
|
||||||
Use case in PHP
|
Use case in PHP
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue