Skip to content

Instantly share code, notes, and snippets.

@cosven
Created February 15, 2020 04:12
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 cosven/15b37c20e56a7b3f98e9f2aa63c4cba7 to your computer and use it in GitHub Desktop.
Save cosven/15b37c20e56a7b3f98e9f2aa63c4cba7 to your computer and use it in GitHub Desktop.
cmd 支持不同格式输出 - 方案性能对比

简单的测试了下时间,目前 4k 首歌曲,大概是这么个情况。

In [16]: start = time.time()
    ...: get_dumper('json').dump(songs)
    ...: print(time.time() - start)
0.3063631057739258

In [17]: start = time.time()
    ...: get_dumper('json').dump(songs)
    ...: print(time.time() - start)
0.14913415908813477
In [11]: start = time.time()
    ...: get_dumper('plain').dump(songs)
    ...: print(time.time() - start)
0.4179658889770508

In [12]: start = time.time()
    ...: get_dumper('plain').dump(songs)
    ...: print(time.time() - start)
0.17125320434570312

但如果使用 fuo show fuo://.../songs,实际上缓存会失效,因为 model 不是同一个。


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