Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

Cache ScriptHash #76

Merged
merged 5 commits into from
Jan 11, 2019
Merged

Cache ScriptHash #76

merged 5 commits into from
Jan 11, 2019

Conversation

shargon
Copy link
Member

@shargon shargon commented Jan 10, 2019

With this PR we could improve the performance of the VM.

Before the change:

  • The VM has the hash cached per ExecutionContext, so every CALL or new ExecutionContext if you want to know the ScriptHash (very usual), you need to compute again the script hash.

After the change:

  • The script hash is computed only once for the script, is cached even though we destroy the ExecutionContext

@vncoelho
Copy link
Member

Sounds good, @shargon

@shargon
Copy link
Member Author

shargon commented Jan 11, 2019

Maybe ICrypto should be static inside the VM, what do you think?

/// <summary>
/// Script
/// </summary>
public readonly byte[] Value;

This comment was marked as resolved.

@shargon
Copy link
Member Author

shargon commented Jan 11, 2019

@erikzhang nice improve :)

@erikzhang erikzhang merged commit 0675aa1 into neo-project:master Jan 11, 2019
@shargon shargon deleted the speedup-vm branch January 11, 2019 12:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants