`
mlzboy
  • 浏览: 701742 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

json seralization is more slower than cpickle

阅读更多
http://oldj.net/article/python-pickle/
i like use jsonpy than py2.6 embedded json lib,beacause it is more friendly for unicode
reference
http://oldj.net/article/python-pickle/


some write style i record here:
import jsonpy
import os.path
import cPickle as pickle
import time
if os.path.exists("cache.pickle"):
    it=time.time()
    cache= pickle.load(open("cache.pickle", "rb"))
    print "cost time:%ss"%(time.time()-it)
    print "直接从cache.pickle载入"
    print len(cache)
if os.path.exists("cache.txt") and (not os.path.exists("cache.pickle")):
    print "从cache.txt载入"
    cc=0
    itit=time.time()
    for line in open("cache.txt","r").readlines():
        cc+=1
        print cc
        k,v=line.strip().split("||||||")
        #print type(jsonpy.read(v))
        cache[k]=jsonpy.read(v)
    print "载入缓存成功"
    print "cost time:%ss"%(time.time()-itit)
    print len(cache)
    from lib import filehelper
    if filehelper.hasfile("cache.pickle"):
        filehlper.delfile("cache.pickle")
        print "删除先前的cache.pickle"
    pickle.dump(cache, open("cache.pickle", "wb"), True)
    print "导出成cache.pickle"


分享到:
评论

相关推荐

    fserial:大多数python内置数据对象的简单快速的{,un}序列化器

    5,000,000 轮转储/装载消耗的时间: fserial.dumps: 1.581582marshal.dumps: 5.548474cPickle.dumps: 5.602932simplejson.loads: #approximate 10x slower than cPickle/marshalfserial.loads:

    Gauss-Jordan-Matrix.zip_As One

    that it requires all the right-hand sides to be stored and manipulated at the same time, and (ii) that when the inverse matrix is not desired, Gauss-Jordan is three times slower than the best ...

    ECDSA快速验签算法

    快速验签算法,Verification of ECDSA signatures is considerably slower than generation of ECDSA signatures. This paper describes a method that can be used to accelerate verification of ECDSA signatures...

    Socket通信,通过异步,解决粘包问题

    Socket通信,通过异步,解决粘包问题

    Why Python is Slow: Looking Under the Hood

    Why Python is Slow: ...# Why Python is Slow Python is slower than Fortran and C for a variety of reasons # Python meta-hacking: Don't take my word for it # Just for fun: a few "never use these" hacks

    世界上最快的VP9视频解码器

    FFvp9 is somewhat slower than ffvp8, and somewhat faster than ffh264 decoding speed (for files encoded to matching SSIM scores). Multi-threading performance in libvpx is deplorable, it gains ...

    fasta-35.3.6.tar.gz_Waterman_fasta_fasta program_sequence alignm

    序列对齐 Compare a protein sequence to a protein sequence database or a DNA sequence to a DNA sequence database ...slower than FASTA3, but is more sensitive for full-length protein sequence comparison.

    A Slower Speed Of Light Mac dmg包

    A Slower Speed of Light 游戏制作者的初心类似互动教学,改变相对论在公众心中的玄学地位。 A Slower Speed Of Light是一款第一人称游戏原型,玩家在 3D 空间中导航,同时拾取逐渐降低光速的球体。定制的、开源的...

    Efficiency Guide (erlang)

    slower than the clean code (because the clean code has become faster, not because the uglier code has become slower). This Efficiency Guide cannot really learn you how to write efficient code. It can ...

    Android代码-GeoLog位置跟踪器

    On foot, you travel slower than by car, and you may not want to gather location data as often. If you're standing still, why track location at all - it's just a waste of power. If you're on a photo ...

    fasterer:不要让你的Ruby走得快。 使它们运行得更快:trade_mark:

    快一点 受和启发,此命令行工具使您的Ruby运行得更...app/models/post.rb:57 Array#select.first is slower than Array#detect. app/models/post.rb:61 Array#select.first is slower than Array#detect. db/seeds/citi

    Cpp-language:在此存储库中,我们将学习C ++的概念

    C ++语言在此存储库中,我们将学习C ++概念CPP中的缓冲区临时存储区称为缓冲...关键点 1.) endl is slower than "\n" 2.) To pass 2 -d array in Function there is 3 special way one is - void func(int **arr,int N)

    开源项目-pzduniak-argon2.zip

    开源项目-pzduniak-argon2.zip,libargon2 converted from C to Go. Only around 10 times slower than the bindings!

    High performance browser networking

    Learn how TCP affects the performance of HTTP Understand why mobile networks are slower than wired networks Use best practices to address performance bottlenecks in HTTP Discover how HTTP 2.0 (based ...

    High Performance Browser Networking

    Learn how TCP affects the performance of HTTP Understand why mobile networks are slower than wired networks Use best practices to address performance bottlenecks in HTTP Discover how HTTP 2.0 (based ...

    比较器ML311

    Although slower than the mA710 (200ns response time vs 40ns), the devices are also much less prone to spurious oscillations. The LM111 series has the same pin configuration as the mA710 series. ...

    Designing, Building And Deploying Messaging Solutions

    Sending data across a network is multiple orders of magnitude slower than making a local method call. Designing a widely distributed solution the same way you would approach a single application ...

    Google C++ Style Guide(Google C++编程规范)高清PDF

    A decent rule of thumb is to not inline a function if it is more than 10 lines long. Beware of destructors, which are often longer than they appear because of implicit member- and base-destructor ...

    7Interrupts and Interrupt Handlers.docx

    Given that processors can be orders of magnitudes faster than the hardware they talk to, it is not ideal for the kernel to issue a request and wait for a response from the significantly slower ...

    How to Think Like a Computer Scientist

    关于java学习的书 大学内部资料 This is the fourth edition of a book I started writing in 1999, when I was teaching ... In other words, they would read it seven times slower than I wrote it.

Global site tag (gtag.js) - Google Analytics