Unverified Commit bdc06fca authored by Dan Sheppard's avatar Dan Sheppard Committed by GitHub
Browse files

Bugfix/perf traveller (#191)

Fix slow slowing-down of genome browser over time due to leak.
parent e4be4631
Pipeline #45622 passed with stages
in 3 minutes and 45 seconds
......@@ -47,7 +47,6 @@ impl WebGLTrainPrinter {
}
pub struct GLPrinterBase {
sridx: usize,
canv_el: HtmlElement,
ctx: Rc<glctx>,
base_progs: GLProgs,
......@@ -68,7 +67,6 @@ impl GLPrinterBase {
let progs = GLProgs::new(&ctx_rc);
let acm = AllCanvasAllocator::new(".bpane-container .managedcanvasholder");
GLPrinterBase {
sridx: 0,
canv_el: canv_el.clone(),
acm, ctx: ctx_rc,
base_progs: progs,
......@@ -162,9 +160,7 @@ impl GLPrinterBase {
}
fn make_driver_traveller(&mut self, pref: &GLPrinter, traveller_id: &TravellerId) -> Box<dyn DriverTraveller> {
let idx = self.sridx;
self.sridx += 1;
let sr = GLTraveller::new(pref,idx,traveller_id);
let sr = GLTraveller::new(pref,traveller_id);
if let Some(carriage) = self.carriages.get_mut(&traveller_id.get_carriage_id()) {
carriage.new_sr(&sr);
}
......
......@@ -12,7 +12,6 @@ use model::train::TravellerId;
#[derive(Clone)]
pub struct GLTraveller {
printer: GLPrinter,
idx: usize,
dr: Rc<RefCell<Option<GLDrawing>>>,
state: Rc<RefCell<bool>>,
traveller_id: TravellerId
......@@ -20,23 +19,22 @@ pub struct GLTraveller {
impl PartialEq for GLTraveller {
fn eq(&self, other: &GLTraveller) -> bool {
self.idx == other.idx
self.traveller_id == other.traveller_id
}
}
impl Eq for GLTraveller {}
impl Hash for GLTraveller {
fn hash<H: Hasher>(&self, state: &mut H) {
self.idx.hash(state);
self.traveller_id.hash(state);
}
}
impl GLTraveller {
/* train/partyresponses */
pub(in super) fn new(printer: &GLPrinter, idx: usize, traveller_id: &TravellerId) -> GLTraveller {
pub(in super) fn new(printer: &GLPrinter, traveller_id: &TravellerId) -> GLTraveller {
GLTraveller {
printer: printer.clone(),
idx,
dr: Rc::new(RefCell::new(None)),
state: Rc::new(RefCell::new(false)),
traveller_id: traveller_id.clone()
......@@ -75,6 +73,6 @@ impl DriverTraveller for GLTraveller {
impl fmt::Debug for GLTraveller {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f,"{:?}[{}]",self.traveller_id,self.idx)
write!(f,"{:?}",self.traveller_id)
}
}
......@@ -7619,8 +7619,8 @@
}
},
"ensembl-genome-browser": {
"version": "https://raw.githubusercontent.com/Ensembl/ensembl-genome-browser-assets/master/assets-1cdabb861b07a31cc27ffa943baf4e10.tar.gz",
"integrity": "sha512-g9jrw7vEqVOyV/jMOOSJNwaYiTtZ7EF7tsGQO01Wc4fSYnHUEhVeGf5zq2Sf2q/S5NFsOrb5QooGxw2rW0Ql3A=="
"version": "https://raw.githubusercontent.com/Ensembl/ensembl-genome-browser-assets/master/assets-50186459b62c96292dcea637e687d290.tar.gz",
"integrity": "sha512-GT02RoNC9pWqe/F7LyoGg6sBJn/gYpV/+bmujjy1f5dnmbsuCsbR5KDc2FT08RVAIaGqjAHdqLDLI5bAbt5wig=="
},
"entities": {
"version": "1.1.2",
......
......@@ -54,7 +54,7 @@
"connected-react-router": "6.5.2",
"core-js": "3.3.6",
"dotenv": "8.2.0",
"ensembl-genome-browser": "https://raw.githubusercontent.com/Ensembl/ensembl-genome-browser-assets/master/assets-1cdabb861b07a31cc27ffa943baf4e10.tar.gz",
"ensembl-genome-browser": "https://raw.githubusercontent.com/Ensembl/ensembl-genome-browser-assets/master/assets-50186459b62c96292dcea637e687d290.tar.gz",
"koa-proxy": "1.0.0-alpha.3",
"lodash": "4.17.15",
"query-string": "6.8.3",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment