Skip to content

Instantly share code, notes, and snippets.

@flavorjones
Last active March 6, 2021 19:26
Show Gist options
  • Save flavorjones/c58bfec205beee49983efbffe05ea426 to your computer and use it in GitHub Desktop.
Save flavorjones/c58bfec205beee49983efbffe05ea426 to your computer and use it in GitHub Desktop.
Nokogiri downloads by architecture

v1.0 45,557 / 2008-10-30

  • ruby: 31,817 (69.84%)
  • x86-mswin32: 13,740 (30.16%)

v1.1 15,989 / 2008-12-21

  • ruby: 8,547 (53.46%)
  • x86-mswin32: 4,616 (28.87%)
  • java: 2,826 (17.67%)

v1.2 40,968 / 2009-02-22

  • ruby: 19,828 (48.40%)
  • java: 11,434 (27.91%)
  • x86-mswin32: 9,706 (23.69%)

v1.3 107,234 / 2009-05-30

  • ruby: 72,198 (67.33%)
  • java: 14,896 (13.89%)
  • x86-mingw32: 10,204 (9.52%)
  • x86-mswin32: 9,936 (9.27%)

v1.4 3,690,271 / 2009-10-30

  • ruby: 3,409,365 (92.39%)
  • x86-mingw32: 133,189 (3.61%)
  • java: 82,998 (2.25%)
  • x86-mswin32: 57,454 (1.56%)
  • x86-mswin32: 7,265 (0.20%)

v1.5 24,412,242 / 2011-07-01

  • ruby: 22,772,718 (93.28%)
  • x86-mingw32: 992,969 (4.07%)
  • java: 615,483 (2.52%)
  • x86-mswin32: 31,072 (0.13%)

v1.6 113,172,590 / 2013-06-08

  • ruby: 102,733,382 (90.78%)
  • java: 7,865,341 (6.95%)
  • x86-mingw32: 1,710,790 (1.51%)
  • x64-mingw32: 858,048 (0.76%)
  • x86-mswin32: 5,029 (0.00%)

v1.7 15,773,774 / 2016-12-27

  • ruby: 14,430,672 (91.49%)
  • java: 797,036 (5.05%)
  • x86-mingw32: 355,366 (2.25%)
  • x64-mingw32: 190,700 (1.21%)

v1.8 84,200,821 / 2017-06-05

  • ruby: 81,649,246 (96.97%)
  • java: 1,880,230 (2.23%)
  • x64-mingw32: 389,766 (0.46%)
  • x86-mingw32: 281,579 (0.33%)

v1.9 5,529,120 / 2018-12-17

  • ruby: 4,213,774 (76.21%)
  • java: 1,285,761 (23.25%)
  • x64-mingw32: 18,171 (0.33%)
  • x86-mingw32: 11,414 (0.21%)

v1.10 119,659,750 / 2019-01-04

  • ruby: 115,379,768 (96.42%)
  • java: 2,981,395 (2.49%)
  • x64-mingw32: 1,117,751 (0.93%)
  • x86-mingw32: 180,836 (0.15%)

v1.11 9,424,731 / 2021-01-04

  • x86_64-linux: 8,560,643 (90.83%)
  • x86_64-darwin: 472,100 (5.01%)
  • ruby: 235,383 (2.50%)
  • x64-mingw32: 84,486 (0.90%)
  • java: 54,832 (0.58%)
  • arm64-darwin: 10,169 (0.11%)
  • x86-mingw32: 4,592 (0.05%)
  • x86-linux: 2,526 (0.03%)

1.6 < 1.11 338,336,055

  • ruby: 318,406,842 (94.11%)
  • java: 14,809,763 (4.38%)
  • x64-mingw32: 2,574,436 (0.76%)
  • x86-mingw32: 2,539,985 (0.75%)
  • x86-mswin32: 5,029 (0.00%)

< 1.6 28,312,261

  • ruby: 26,314,473 (92.94%)
  • x86-mingw32: 1,136,362 (4.01%)
  • java: 727,637 (2.57%)
  • x86-mswin32: 67,390 (0.24%)
  • x86-mswin32: 66,399 (0.23%)
#! /usr/bin/env ruby
# frozen_string_literal: true
require "bundler/inline"
PRINT_COUNTS = true
gemfile(true) do
gem "activesupport"
gem "json"
gem "yaml"
end
require "json"
require "yaml"
require "date"
require "open-uri"
require "active_support"
# downloads[version][arch] = download_count
def new_downloads_hash
Hash.new do |h, version|
h[version] = Hash.new do |h, arch|
h[arch] = 0
end
end
end
downloads = new_downloads_hash
pre_111 = new_downloads_hash
date_first = {}
def print_int(int)
ActiveSupport::NumberHelper.number_to_delimited(int)
end
def print_archs_table(archs)
archs.sort_by { |arch, count| -count }
.reject { |arch, _| arch == "total" }
.each do |arch, count|
arch = arch.split("-")[0..1].join("-")
if PRINT_COUNTS
printf("- %-14s %11s (%.2f%%)\n", arch + ":", print_int(count), 100.0 * count / archs["total"])
else
printf("- %-14s %.2f%%\n", arch + ":", 100.0 * count / archs["total"])
end
end
end
versions = JSON.parse(URI.open("https://rubygems.org/api/v1/versions/nokogiri.json").read)
versions.each do |gem_version|
version = Gem::Version.new(gem_version["number"])
next if version.prerelease?
maj_min = Gem::Version.new(version.segments[0..1].join("."))
downloads[maj_min][gem_version["platform"]] += gem_version["downloads_count"]
downloads[maj_min]["total"] += gem_version["downloads_count"]
date = Date.parse(gem_version["built_at"])
if date_first[maj_min].nil? || date_first[maj_min] > date
date_first[maj_min] = date
end
key = if maj_min < Gem::Version.new("1.6")
"< 1.6"
elsif maj_min < Gem::Version.new("1.11")
"1.6 < 1.11"
else
nil
end
if key
pre_111[key][gem_version["platform"]] += gem_version["downloads_count"]
pre_111[key]["total"] += gem_version["downloads_count"]
end
end
downloads.sort_by { |maj_min, archs| maj_min }.each do |maj_min, archs|
if PRINT_COUNTS
printf("# v%-13s %11s / %s\n", maj_min, print_int(archs["total"]), date_first[maj_min])
else
printf("# v%-13s %s\n", maj_min, date_first[maj_min])
end
print_archs_table(archs)
puts
end
pre_111.each do |version, archs|
if PRINT_COUNTS
printf("# %-13s %11s\n", version, print_int(archs["total"]))
else
printf("# %-13s\n", version)
end
print_archs_table(archs)
puts
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment