Skip to content

Commit

Permalink
fetch: use faster yaml.CLoader
Browse files Browse the repository at this point in the history
This dramatically increases yaml.load() speed ᕕ( ᐛ )ᕗ

Still much slower than JSON, but at least bearable now.

Change-Id: I35f6169f2093e279c32254f8cdf45b00b831e81b
  • Loading branch information
Jakub Ružička committed Feb 7, 2019
1 parent 18eb6ba commit 6f43244
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion distroinfo/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
import os
import requests
import yaml
try:
from yaml import CLoader as Loader
except ImportError:
from yaml import Loader

from distroinfo import exception
from distroinfo import helpers
Expand Down Expand Up @@ -41,7 +45,7 @@ def get_file_content(self, fn):

def get_file_data(self, fn):
content = self.get_file_content(fn)
return yaml.load(content)
return yaml.load(content, Loader=Loader)

def fetch(self, *info_files, **kwargs):
contents = []
Expand Down

0 comments on commit 6f43244

Please sign in to comment.