Skip to content

Instantly share code, notes, and snippets.

@nurkiewicz
Created February 13, 2024 12:02
Show Gist options
  • Save nurkiewicz/74f530cccd8424c92223926e1d719d0f to your computer and use it in GitHub Desktop.
Save nurkiewicz/74f530cccd8424c92223926e1d719d0f to your computer and use it in GitHub Desktop.
const fs = require('fs')
const json = fs.readFileSync('large.json').toString()
// Run this several times, collect times in spreadsheet, like an animal
start = Date.now(); JSON.parse(json); Date.now() - start
import json
import uuid
def generate_large_json(num_objects):
data = {}
for i in range(num_objects):
data['key-' + str(i)] = {
'id': i,
'name': 'name-' + str(uuid.uuid4()),
'value': uuid.uuid4().hex * 10,
'data': generate_large_json(int(num_objects / 10)) if num_objects > 5 else {}
}
return data
json.dump(generate_large_json(100), open('large.json', 'w'), indent=4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment