Throughput in operations per second
Regex router | Vert.x http-router |
---|---|
219136.313 | 864257.727 |
You can measure it on your own machine by using the BenchmarkRunner. The http-router should be at least 3 times faster than a regex based RouteMatcher.
Details about the comparison can be found here.
RouteHandler printUser = (req, params) -> req.
response().end(params.get(":action") + " " + params.get(":user"));
RouteHandler printPath = (req, params) -> req.
response().end("filepath " + params.get("*filepath"));
Router router = router()
.get("/api/:user/:action", printUser)
.get("/*filepath", printPath);
server.requestHandler(router)
.listen();
- make it feature complete
- make it stable
- improve performance
- simple and lightweight
- easy to integrate
- high performance
- scalable
<dependency>
<groupId>com.github.spriet2000</groupId>
<artifactId>vertx-http-router</artifactId>
<version>0.0.2-SNAPSHOT</version>
</dependency>
https://oss.sonatype.org/content/repositories/snapshots/com/github/spriet2000
Thanks to Tahseen Ur Rehman, Javid Jamae and Dennis Heidsiek for their clear implementation of a radix tree in java which helped me getting started.
And many thanks to Julien Schmidt for his excellent httprouter!