⚡️ Speed up function serialize_datetime by 30%
          #3
        
          
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
📄 30% (0.30x) speedup for
serialize_datetimeinsrc/deepgram/core/datetime_utils.py⏱️ Runtime :
3.58 milliseconds→2.75 milliseconds(best of195runs)📝 Explanation and details
Key optimizations:
dt.datetime.now().astimezone().tzinfo."Z"replacement usingstr.endswithand slicing, which is faster thanstr.replacewhen the string likely ends with "+00:00".✅ Correctness verification report:
🌀 Generated Regression Tests and Runtime
⏪ Replay Tests and Runtime
test_pytest_testsintegrationstest_integration_scenarios_py_testsunittest_core_utils_py_testsutilstest_htt__replay_test_0.py::test_deepgram_core_datetime_utils_serialize_datetimetest_pytest_testsintegrationstest_manage_client_py_testsunittest_core_query_encoder_py_testsunittest_type__replay_test_0.py::test_deepgram_core_datetime_utils_serialize_datetimeTo edit these changes
git checkout codeflash/optimize-serialize_datetime-mh2qlbcuand push.