This PR started as a bug fix, but as I worked on it, I found that I could get massive perf improvements.
In the SDK init_session, some data is cached. Before this PR, just de deployment was cached.
But the whole session can actually be cached. It reduces file system access by a lot (in a Vitest context, we now only need to read the manifest and contract once) and reduce the time spent parsing contracts.
On my machine (M1), the cached init_session go from more than 100ms to a few ms (the time taken for cache.clone()). And knowing that init_session is called before each test, it takes the time to run tests in a project like pox-4 testing down from 32sec to 6secs
It also reworks a bit the session and the SDK structs
Description
Fix #1435
This PR started as a bug fix, but as I worked on it, I found that I could get massive perf improvements.
In the SDK
init_session
, some data is cached. Before this PR, just de deployment was cached. But the whole session can actually be cached. It reduces file system access by a lot (in a Vitest context, we now only need to read the manifest and contract once) and reduce the time spent parsing contracts.On my machine (M1), the cached
init_session
go from more than 100ms to a few ms (the time taken forcache.clone()
). And knowing thatinit_session
is called before each test, it takes the time to run tests in a project like pox-4 testing down from 32sec to 6secsIt also reworks a bit the session and the SDK structs