Skip to content

Commit

Permalink
Add some timing log statements
Browse files Browse the repository at this point in the history
  • Loading branch information
jrobinso committed Jan 31, 2025
1 parent afd9610 commit fa9eb4d
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions examples/interactive-filtering2.html
Original file line number Diff line number Diff line change
Expand Up @@ -945,8 +945,16 @@
const filterChange = () => {
const selection = getSelection()
const filterFunction = buildFilter(selection, facets)

const t1 = Date.now()
trackToFilter.filter = filterFunction
const t2 = Date.now()
console.log(`Apply filter: ${t2 - t1}`)

const t3 = Date.now()
updateFilterCounts(trackToFilter, facets)
const t4 = Date.now()
console.log(`Update filter counts: ${t4 - t3}`)
}

// Apply initial filter, which might filter a few features
Expand Down Expand Up @@ -1153,7 +1161,14 @@
/** Get counts for each filter, in each facet */
function updateFilterCounts(trackToFilter, facets) {

const featuresInView = trackToFilter.getInViewFeatures()
const t0 = Date.now();

const featuresInView = trackToFilter.getInViewFeatures()

const t1 = Date.now()
console.log(` getInViewFeatures: ${t1 - t0}`)

const t2 = Date.now()

// Reset counts
for (let facet of facets) {
Expand All @@ -1168,6 +1183,10 @@
}
}

const t3 = Date.now()
console.log(` reset counts: ${t3 - t2}`)

const t4 = Date.now();
// Loop through features counting by filter
for (let igvFeature of featuresInView) {

Expand Down Expand Up @@ -1196,8 +1215,10 @@
}
}
}
const t5 = Date.now();
console.log(` count by filter: ${t5 - t4}`)


const t6 = Date.now()
// Update dom
for (let facet of facets) {

Expand All @@ -1218,6 +1239,9 @@
}
}

const t7 = Date.now()
console.log(` updateDom: ${t7 - t6}`)

}


Expand Down

0 comments on commit fa9eb4d

Please sign in to comment.