msgraph-sdk-python icon indicating copy to clipboard operation
msgraph-sdk-python copied to clipboard

The first request is very slow

Open michaelmesser opened this issue 1 year ago • 1 comments

Not sure if performance is a feature request or bug.

import win32gui
from azure.identity.broker import InteractiveBrowserBrokerCredential
from msgraph.graph_service_client import GraphServiceClient

1.1s (Already in issue #904)

current_window_handle = win32gui.GetForegroundWindow()
credentials = InteractiveBrowserBrokerCredential(
    tenant_id=tenant,
    client_id=client_id,
    use_default_broker_account=True,
    parent_window_handle=current_window_handle,
)

0.0s (Expected)

client = GraphServiceClient(
    credentials=credentials,
    scopes=[]
)

0.4s (Slower than I would expect)

await client.me.get()

2.2s (1st request. This is significantly slower than I would expect)

await client.me.get()

0.1s (2nd request. Expected)

michaelmesser avatar Sep 30 '24 22:09 michaelmesser

Were you able to determine why this is so slow? I think it should only be making a few requests, so I would expect it to be significantly faster.

michaelmesser avatar Jan 31 '25 20:01 michaelmesser