proposal-array-filtering icon indicating copy to clipboard operation
proposal-array-filtering copied to clipboard

Query Data from the HTTP Archive and GitHub Archive

Open jridgewell opened this issue 6 years ago • 4 comments

Underscore Function Count Percentage vs filter
_.filter 427,420
_.select 8,743 2%
_.reject 64,018 15%
_.partition 7,013 1.6%

Using the following query format:

SELECT
  COUNT(*)
FROM
  `httparchive.response_bodies.2019_10_01_desktop`
WHERE
  REGEXP_CONTAINS(body, r"_\.filter\(")

jridgewell avatar Oct 28 '19 20:10 jridgewell

Query data from 2016-01-01 (when underscore/lodash were more popular):

Underscore Function Count Percentage vs filter
_.filter 8,764
_.select 576 6.5%
_.reject 1,858 21%
_.partition 137 1.6%

jridgewell avatar Oct 28 '19 21:10 jridgewell

It seems _.select has been removed in the recent version of lodash?

hax avatar Oct 30 '19 15:10 hax

Right, v4.0.0 removed all aliases.

jridgewell avatar Oct 30 '19 20:10 jridgewell

Querying github archive for ruby files (which has select, reject, filter, and partition as first class methods):

Ruby Function Count Relative percentage
filter 10475 4.8%
select 141987 65.5%
reject 59052 27.2%
partition 5414 2.5%
SELECT
  COUNT(*)
FROM
  `bigquery-public-data.github_repos.contents`
WHERE
  NOT binary
  AND REGEXP_CONTAINS(content, r"\.reject\b")
  AND id IN (
    SELECT id FROM `bigquery-public-data.github_repos.files`
    WHERE ENDS_WITH(path, '.rb')
  )

jridgewell avatar Dec 06 '19 21:12 jridgewell