title: Why does it take more time to reach view after crossing middleware in Django?
body: <p>These are following middleware in my project:</p>
  
  <pre><code>MIDDLEWARE_CLASSES = [ 
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'simple_history.middleware.HistoryRequestMiddleware',
    'apps.quiz.totaltimemid.TimeCalculateMiddleware',
    ]
  </code></pre>
  
  <p>My custom middleware to measure time for reaching process_view of last middleware to my target view(class QuizFetchView(APIView)):</p>
  
  <pre><code>class TimeCalculateMiddleware(object):
  
      def process_view(self, request, callback, callback_args, 
          callback_kwargs):
          self.req_start_time = time.time()
  
  
      def process_response(self,request, response):
          try :
              response['vreach_time'] = float(response['tt_start']) - self.req_start_time
              return response
          except :
              return response 
  </code></pre>
  
  <p>Target view:</p>
  
  <pre><code>class QuizFetchView(APIView):
      permission_classes = [IsAuthenticated, IsAuthenticatedForRunningQuiz]
      def get(self, request: Request, key: str) -&gt; Response:
          tt_start = time.time()
          .............. 
          .............. 
          ............
          Response['tt_start'] = tt_start
          return Response
  </code></pre>
  
  <p>For Login request middleware to view take very few milliseconds but subsequent request other than login take 25-35ms to reach view.</p>
  
  <p>Please help me, Thank you  </p>