perf: sandbox reset
This commit is contained in:
parent
89c32a2299
commit
bb7435e18e
|
@ -30,7 +30,7 @@ export default class Sandbox {
|
|||
compile() {
|
||||
let scope = new Scope();
|
||||
scope.context = this.$$context;
|
||||
this.scopes = new WeakMap([[this.ast, scope]]);
|
||||
this.scopes = new Map([[this.ast, scope]]);
|
||||
traverse(
|
||||
this.ast,
|
||||
(node, verb) => {
|
||||
|
@ -250,7 +250,10 @@ export default class Sandbox {
|
|||
|
||||
reset() {
|
||||
this.generator = undefined;
|
||||
this.compile();
|
||||
for (const scope of this.scopes.values()) {
|
||||
scope.context = {};
|
||||
}
|
||||
this.scopes.get(this.ast).context = this.$$context;
|
||||
}
|
||||
|
||||
run(ops = 1000) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user