Skip to content

Instantly share code, notes, and snippets.

@nicholasbishop
Created November 25, 2022 21:46
Show Gist options
  • Save nicholasbishop/64d72cd3b37524c5906b4f6158c7ec1f to your computer and use it in GitHub Desktop.
Save nicholasbishop/64d72cd3b37524c5906b4f6158c7ec1f to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
# Usage:
#
# git clone https://github.com/rust-lang/crates.io-index.git
# cd crates.io-index
# Run features.py
import collections
import json
import os
def main():
feature_counts = collections.Counter()
for (root, dirs, files) in os.walk('.'):
# Skip hidden
dirs[:] = [d for d in dirs if not d[0] == '.']
for name in files:
if name == 'config.json':
continue
path = os.path.join(root, name)
with open(path, 'r') as rfile:
lines = rfile.read().splitlines()
last_version = json.loads(lines[-1])
features = last_version['features']
feature_counts.update(features.keys())
for name, count in feature_counts.most_common(100):
print('{}: {}'.format(name, count))
if __name__ == "__main__":
main()
@nicholasbishop
Copy link
Author

Output as of Nov 25, 2022:

default: 15510
std: 3074
native-tls: 947
rustls: 945
nightly: 770
alloc: 755
rt: 702
unstable: 555
serialize_structs: 430
deserialize_structs: 430
full: 400
derive: 383
rt-tokio: 339
async: 312
serde: 296
json: 283
cli: 276
all: 274
enable_reqwest_rustls: 265
enable_reqwest: 265
debug: 264
no-default-tag: 253
no-entrypoint: 248
static: 236
dox: 222
serialize: 216
parallel: 205
client: 191
server: 171
tls: 166
cpi: 163
wasm: 160
backtraces: 153
no-idl: 146
bench: 144
rustls-tls: 142
test: 140
sync: 135
postgres: 131
sqlite: 127
no_std: 125
macros: 120
dev: 115
doc: 114
trace: 111
serialization: 107
simd: 105
docs: 105
testing: 104
blocking: 103
web: 101
strict: 99
tokio: 96
mysql: 94
serde1: 93
logging: 91
library: 91
core: 89
http: 86
vendored-openssl: 85
use_std: 84
serde_support: 84
experimental: 83
bin: 79
openssl: 76
vendored: 75
test-bpf: 75
runtime-benchmarks: 75
asm: 72
yaml: 72
python: 71
stream: 70
cuda: 68
compression: 65
with-serde: 65
fuzzing: 64
ssl: 62
profiler: 62
runtime: 62
capi: 59
ffi: 58
build: 57
native: 56
default-tls: 53
log: 52
random: 52
metrics: 52
gzip: 51
color: 51
tracing: 51
v1_18: 51
v1_22: 51
wasm-bindgen: 50
v1_16: 50
time: 49
no-log-ix-name: 49
opencl: 48
v1_20: 48
docs-rs: 46
compress: 46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment