Skip to content

Commit

Permalink
fix: use top 50, top 100 is useless
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce committed Mar 14, 2019
1 parent 647a174 commit 37b69df
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
19 changes: 9 additions & 10 deletions bin/find-entities-to-label.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ function computeAllStats(dataset) {
.reverse()
.value()

const top100Occurrences = _.sumBy(
sortedEntityData.filter(e => e !== homelessMegaEntity).slice(0, 100),
const top50Occurrences = _.sumBy(
sortedEntityData.filter(e => e !== homelessMegaEntity).slice(0, 50),
'totalOccurrences',
)

return {
sortedEntityData,
top100Occurrences,
top50Occurrences,
homelessGrouped,
totalEntityOccurrences,
}
Expand All @@ -118,7 +118,7 @@ function computeChangesSinceLast(currentDataset, lastDataset) {
const currentDatasetStats = computeAllStats(CURRENT_DATASET)
const lastDatasetStats = computeAllStats(LAST_DATASET)

const {top100Occurrences, homelessGrouped, totalEntityOccurrences} = currentDatasetStats
const {top50Occurrences, homelessGrouped, totalEntityOccurrences} = currentDatasetStats

const changesSinceLast = computeChangesSinceLast(currentDatasetStats, lastDatasetStats)

Expand Down Expand Up @@ -160,20 +160,19 @@ console.log(
)

console.log(
'Top 100 Entities representing',
((top100Occurrences / GLOBAL_OCCURRENCES) * 100).toFixed(2),
'3rd parties representing',
((THIRD_PARTY_REQUESTS / GLOBAL_OCCURRENCES) * 100).toFixed(2),
'% of total requests',
)

console.log(
'Entities representing',
((totalEntityOccurrences / THIRD_PARTY_REQUESTS) * 100).toFixed(2),
'% of 3rd parties',
)
console.log(
'3rd parties representing',
((THIRD_PARTY_REQUESTS / GLOBAL_OCCURRENCES) * 100).toFixed(2),
'% of total requests',
'Top 50 Entities representing',
((top50Occurrences / totalEntityOccurrences) * 100).toFixed(2),
'% of all entity requests',
)

console.log('Finished processing', datasetFiles[0])
19 changes: 9 additions & 10 deletions bin/merge-origins-with-entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ function computeAllStats(dataset) {
.reverse()
.value()

const top100ExecutionTime = _.sumBy(
sortedEntityData.filter(e => e !== homelessMegaEntity).slice(0, 100),
const top50ExecutionTime = _.sumBy(
sortedEntityData.filter(e => e !== homelessMegaEntity).slice(0, 50),
'totalExecutionTime',
)

return {sortedEntityData, top100ExecutionTime, homelessGrouped, totalEntityExecutionTime}
return {sortedEntityData, top50ExecutionTime, homelessGrouped, totalEntityExecutionTime}
}

function computeChangesSinceLast(currentDataset, lastDataset) {
Expand All @@ -122,7 +122,7 @@ const lastDatasetStats = computeAllStats(LAST_DATASET)

const {
sortedEntityData,
top100ExecutionTime,
top50ExecutionTime,
homelessGrouped,
totalEntityExecutionTime,
} = currentDatasetStats
Expand Down Expand Up @@ -180,20 +180,19 @@ console.log(
)

console.log(
'Top 100 Entities representing',
((top100ExecutionTime / GLOBAL_EXECUTION_TIME) * 100).toFixed(2),
'3rd parties representing',
((THIRD_PARTY_EXECUTION_TIME / GLOBAL_EXECUTION_TIME) * 100).toFixed(2),
'% of total script execution',
)

console.log(
'Entities representing',
((totalEntityExecutionTime / THIRD_PARTY_EXECUTION_TIME) * 100).toFixed(2),
'% of 3rd parties',
)
console.log(
'3rd parties representing',
((THIRD_PARTY_EXECUTION_TIME / GLOBAL_EXECUTION_TIME) * 100).toFixed(2),
'% of total script execution',
'Top 50 Entities representing',
((top50ExecutionTime / totalEntityExecutionTime) * 100).toFixed(2),
'% of total entity execution',
)

fs.writeFileSync(
Expand Down

0 comments on commit 37b69df

Please sign in to comment.