Skip to content

Commit

Permalink
Removed unnecessary calls to _recompute_all_models() to speed up addi…
Browse files Browse the repository at this point in the history
…ng roots (#11739)

* Removed unnecessary calls to _recompute_all_models() to speed up adding roots

* Corrected last commit so that general calls to add_root() still call recompute_all_models(), and that is only worked around in special situations.

* Wrapping calls to add_root() within push_all_models_freeze()

* Made last commit more elegant by getting rid of loop

Co-authored-by: Efrem Braun <efrem.braun@gmail.comm>
  • Loading branch information
2 people authored and bryevdv committed Dec 13, 2021
1 parent e51d301 commit a904798
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bokehjs/src/lib/document/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -642,12 +642,14 @@ export class Document {
Document._initialize_references_json(references_json, new Map(), references, new Map())

const doc = new Document({resolver})
doc._push_all_models_freeze()
for (const id of root_ids) {
const root = references.get(id)
if (root != null) {
doc.add_root(root as Model) // XXX: HasProps
}
}
doc._pop_all_models_freeze()
doc.set_title(json.title!) // XXX!
return doc
}
Expand Down

0 comments on commit a904798

Please sign in to comment.