mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
import: Migrate from json to ujson for better perf.
We expect to get better memory performace from ujson than json. We also do a better job of closing file handles. This likely fixes #10377.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import json
|
||||
import random
|
||||
import requests
|
||||
import shutil
|
||||
import logging
|
||||
import os
|
||||
import ujson
|
||||
|
||||
from typing import List, Dict, Any, Optional, Set
|
||||
from django.forms.models import model_to_dict
|
||||
@@ -509,4 +509,5 @@ def process_emojis(zerver_realmemoji: List[ZerverFieldsT], emoji_dir: str,
|
||||
def create_converted_data_files(data: Any, output_dir: str, file_path: str) -> None:
|
||||
output_file = output_dir + file_path
|
||||
os.makedirs(os.path.dirname(output_file), exist_ok=True)
|
||||
json.dump(data, open(output_file, 'w'), indent=4)
|
||||
with open(output_file, 'w') as fp:
|
||||
ujson.dump(data, fp, indent=4)
|
||||
|
||||
Reference in New Issue
Block a user