Open lauri865 opened 9 months ago
Just checked the implementation - could it be due to the locking mechanism? It's a bit unclear (to an outsider) why the function as a whole needs locks? Refresh session, sure, perhaps not the session fetching part.
I imagine it's often used for client-side route protections, etc. Which just adds an unnecessary delay to page renders and delay before data fetching starts.
Just noticed the same thing here! Meanwhile this is fixed, can you share your JWT implementation pls ?
Thx
Bug report
Describe the bug
supabase.auth.getSession()
can take anywhere from 20ms up to 100ms on a fast processor (M2 Pro) when invoked e.g. during an initial page rendering phase. This feels way too slow for a function that doesn't do any network calls.For comparison, a custom function I mocked up that reads the cookie, parses accessToken and returns the JWT as an object (json.parse+base64decode+json.parse) takes around 0.3-0.4ms under the same load, and is similarly performant during idle and rendering phase.
Benchmarks (rough): During rendering phase:
Idle phase:
Given the above, it's unlikely that it's caused by anything specific to my app, since the custom implementation doesn't slow down at all during rendering phase vs. idle phase.
To Reproduce
Expected behavior
Under 1ms performance for a function that is doing simple local processing..
Screenshots
If applicable, add screenshots to help explain your problem.
System information
Additional context
What's worse, it's similarly slow even when there's no cookie present.