Skip to content

Instantly share code, notes, and snippets.

@lucaswerkmeister
Created Jul 26, 2017
Embed
What would you like to do?
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

lucaswerkmeister commented Jul 26, 2017

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