<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      Python3 基本類型在64位上的占用內存情況

      基本類型占用的內存

      • 類型
      • # -*- coding: utf-8 -*- 
        # @Time     : 2019-12-19 11:16
        # @Author   : binger
        
        import sys
        
        a = None
        b = 1000.2311
        c = 1000
        d = True
        e = ""
        f = ()
        g = []
        h = set([])
        i = {}
        
        print(" %s size is %d " % (type(a), sys.getsizeof(a)))
        print(" %s size is %d " % (type(b), sys.getsizeof(b)))
        print(" %s size is %d " % (type(c), sys.getsizeof(c)))
        print(" %s size is %d " % (type(d), sys.getsizeof(d)))
        print(" %s size is %d " % (type(e), sys.getsizeof(e)), sys.getsizeof("12"))
        print(" %s size is %d " % (type(f), sys.getsizeof(f)), sys.getsizeof((1,)))
        print(" %s size is %d " % (type(g), sys.getsizeof(g)), sys.getsizeof([1, ]))
        print(" %s size is %d " % (type(h), sys.getsizeof(h)), sys.getsizeof(set([1, ])))
        print(" %s size is %d " % (type(i), sys.getsizeof(i)), sys.getsizeof({1: 1}))
      • 結果:
        內存大小排行: None < float < int = bool < str < tuple < list < set < dict
      •  <class 'NoneType'> size is 16 Byte 
         <class 'float'> size is 24 Byte
         <class 'int'> size is 28 Byte
         <class 'bool'> size is 28 Byte
         <class 'str'> size is 49  Byte 51
         <class 'tuple'> size is 56  Byte 64
         <class 'list'> size is 72  Byte 80
         <class 'set'> size is 232  Byte 232
         <class 'dict'> size is 248  Byte 248

         

      分析:

      • int和float:
        • int和float的64位系統中的 Python 3 內存消耗:int > float
        • 間接費用(PyObject_HEAD)增加了一倍,但整數的大小從32位變為64位,而浮點數(雙精度)的大小仍為64:
        • 32位
          int:開銷= 10字節,值= 4字節
          float:開銷= 8字節,value = 8字節
          
          64位
          int:開銷= 20字節,值= 8字節
          float:開銷= 16個字節,值= 8個字節
        • 64位 Python 2 中 int 和 float 均為 24B。但是 int 不包含 long類型(28B)
      • 字典與鏈表
      from bintrees import bintree
      import uuid, time, sys
      import random
      
      
      def create_uuid(msg):
          src_uuid = uuid.uuid4()
          name = "{}{}".format(time.time(), msg)
          return uuid.uuid3(src_uuid, name=name).hex
      
      
      a = {create_uuid(i): random.randint(0, 10) for i in range(2000)}
      b = {i: i for i in range(2000)}
      ring = bintree.BinaryTree()
      c = [ring.insert(create_uuid(i), i) for i in range(2000)]
      ring2 = bintree.BinaryTree()
      d = [ring2.insert(i, i) for i in range(2000)]
      
      print("字典1", sys.getsizeof(a))
      print("字典2", sys.getsizeof(b))
      print("二叉樹:", sys.getsizeof(c))
      print("二叉樹:", sys.getsizeof(d))
        • 結果:
      字典1 73832
      字典2 73832
      二叉樹: 16568
      二叉樹: 16568

       

      posted @ 2019-12-19 14:07  binger0712  閱讀(1659)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 久久精品免费观看国产| 欧美在线一区二区三区精品| 国产一区二区精品久久呦| 日本久久香蕉一本一道| 精品人妻伦九区久久69| 通化市| 天天做天天爱夜夜爽导航| 欧美色欧美亚洲高清在线视频| 国产福利高颜值在线观看| 一区二区三区四区激情视频| 欧美日韩国产图片区一区| 欧美三级欧美成人高清| 国产人成视频在线观看| 蜜臀av午夜精品福利| 日本熟妇XXXX潮喷视频| 无码人妻一区二区三区四区AV | 亚洲精品一区二区麻豆| 亚洲国产精品午夜福利| 好先生在线观看免费播放| 熟女精品色一区二区三区| 精品人妻无码一区二区三区性| 国产精品亚洲片夜色在线| 河津市| 日本亲近相奷中文字幕| 亚洲爆乳成av人在线视菜奈实| 亚洲美女高潮不断亚洲| 国产成人免费午夜在线观看| 在线精品视频一区二区三四| 亚洲精品一区二区三区免| 男女动态无遮挡动态图| 52熟女露脸国语对白视频| 午夜成年男人免费网站| a片在线免费观看| 亚洲国产精品成人综合色在| 精品一区二区三区自拍图片区| 欧美日韩欧美| 99久久久无码国产麻豆| 人人澡超碰碰97碰碰碰| 青青青视频免费一区二区| 大屁股国产白浆一二区| 在线午夜精品自拍小视频|