Slow response time

Hello friends. I’ve picked up Hanami a month ago and building a small side-project with it. I’ve noticed weird slow response time for a simplest request possible.

get '/test', to: ->(env) { [200, {}, ['Hello from Hanami!']] }

I’m running Puma server on localhost in prod. mode:
HANAMI_ENV=production bundle exec hanami server

Puma logs shows that server responds within a very small period of time:

{
    "app": "***",
    "severity": "INFO",
    "time": "2019-08-25T22:19:05Z",
    "http": "HTTP/1.1",
    "verb": "GET",
    "status": "200",
    "ip": "192.168.0.59",
    "path": "/test",
    "length": "18",
    "params": {},
    "elapsed": 0.002606994
}

But a browser or CURL give me ~300ms for this request. Can someone please help me. I absolutely love Hanami, but I can’t use it in production if it’s this slow :disappointed_relieved:

It looks like it’s the same question posted here: Creating an API with Hanami
but no answer was posted. Would appreciate any information!

alright, it’s much faster with --no-code-reload. Response time goes down dramatically

I can recommend you to use the hanami-reloader gem as it uses guard under the hood. It may introduce a small interval between changes being made and the code reloading, but it works way better.

Our original code reloading algorithm was… hacky.