Skip to content

Instantly share code, notes, and snippets.

@lucaswerkmeister
Created July 26, 2017 11:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucaswerkmeister/984984b7c534955d7e48292bf55dffd0 to your computer and use it in GitHub Desktop.
Save lucaswerkmeister/984984b7c534955d7e48292bf55dffd0 to your computer and use it in GitHub Desktop.
How much do entity pages grow if you add snak IDs to the output?
for id in Q$RANDOM Q$RANDOM Q$RANDOM Q$RANDOM Q$RANDOM; do
html=$(curl -s "https://www.wikidata.org/wiki/$id");
bytesCurrent=$(printf '%s' "$html" |
wc -c);
bytesWithId=$(printf '%s' "$html" |
sed 's|class="wikibase-snakview"|class="wikibase-snakview wikibase-snakview-0000111122223333444455556666777788889999"|g' |
wc -c);
LC_ALL=C printf '%s\nCurrent: %8d bytes\nWith ID: %8d bytes\nChange: %.3f%%\n---\n' \
"$id" \
"$bytesCurrent" \
"$bytesWithId" \
"$(bc <<< "scale=10; 100 * ($bytesWithId/$bytesCurrent - 1)")";
done
@lucaswerkmeister
Copy link
Author

A very large example entity to test is Q21558717.

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