tc39/proposal-array-filtering

Query Data from the HTTP Archive and GitHub Archive

jridgewell opened this issue · 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\(")

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%
hax commented

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

Right, v4.0.0 removed all aliases.

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')
  )