Skip to content

Instantly share code, notes, and snippets.

@non-Jedi
Created March 16, 2019 00:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save non-Jedi/22f1d21925346fe8d05598257274c92f to your computer and use it in GitHub Desktop.
Save non-Jedi/22f1d21925346fe8d05598257274c92f to your computer and use it in GitHub Desktop.
Benchmarking HTTP.jl
using HTTP
abstract type DummyConnectionLayer{Next <: HTTP.Layer} <: HTTP.Layer end
st = HTTP.RedirectRequest.RedirectLayer{HTTP.MessageRequest.MessageLayer{
HTTP.RetryRequest.RetryLayer{HTTP.ExceptionRequest.ExceptionLayer{
DummyConnectionLayer{Union{}}}}}}
uri = HTTP.URI("https://example.com/random/path?query=param&foo=bar")
headers = HTTP.Headers()
function HTTP.request(::Type{DummyConnectionLayer{Next}}, url::HTTP.URI, req, body;
proxy=nothing, socket_type::Type=HTTP.TCPSocket,
reuse_limit::Int=HTTP.ConnectionPool.nolimit, kw...) where Next
HTTP.Response(200)
end#function
using BenchmarkTools
@btime HTTP.request($st, "POST", $uri, $headers, "hello")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment