Changeset 337
- Timestamp:
- 06/21/08 00:17:44 (4 years ago)
- Location:
- hodgestar/Talks/PythonObjects
- Files:
-
- 2 added
- 7 modified
-
html/pyobjects-0.html (modified) (1 diff)
-
html/pyobjects-10.html (added)
-
html/pyobjects-3.html (modified) (1 diff)
-
html/pyobjects-5.html (modified) (1 diff)
-
html/pyobjects-6.html (modified) (1 diff)
-
html/pyobjects-7.html (modified) (1 diff)
-
html/pyobjects-8.html (modified) (1 diff)
-
html/pyobjects-9.html (added)
-
pyobjects.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
hodgestar/Talks/PythonObjects/html/pyobjects-0.html
r334 r337 12 12 <li><a href='pyobjects-3.html'>Strings</a></li> 13 13 <li><a href='pyobjects-4.html'>Find Big Dict</a></li> 14 <li><a href='pyobjects-5.html'>Gamboling With Slots</a></li> 15 <li><a href='pyobjects-6.html'>PyObject C API</a></li> 16 <li><a href='pyobjects-7.html'>object.c</a></li> 17 <li><a href='pyobjects-8.html'>New Python Documents - ZOMG!</a></li> 14 <li><a href='pyobjects-5.html'>Ints</a></li> 15 <li><a href='pyobjects-6.html'>Int (speed)</a></li> 16 <li><a href='pyobjects-7.html'>Gamboling With Slots</a></li> 17 <li><a href='pyobjects-8.html'>PyObject C API</a></li> 18 <li><a href='pyobjects-9.html'>object.c</a></li> 19 <li><a href='pyobjects-10.html'>New Python Documents - ZOMG!</a></li> 18 20 </ol> 19 21 <br /></body></html> -
hodgestar/Talks/PythonObjects/html/pyobjects-3.html
r332 r337 27 27 28 28 <li>Constants strings of size <= 20 cache by parser (TODO: check).</li> 29 30 <li>PyString_InternInPlace (PyUnicode_InternInPlace in 3.0) results in strings being stored in internal dictionary.<ul><li>Reference in interned not counted in reference count (nasty hack to hide this from users).</li> 31 </ul></li> 32 33 <li>Strings are replaced by Unicode in 3.0</li> 29 34 </ul> 30 35 <br /><div class="footer"><hr />Everything You Didn't Want to Known About Python Objects</div></body></html> -
hodgestar/Talks/PythonObjects/html/pyobjects-5.html
r333 r337 6 6 </head> 7 7 <body> 8 <a accesskey="P" href="pyobjects-4.html">Prev</a> | <a href="pyobjects-0.html">Index</a> | <a acesskey="N" href="pyobjects-6.html">Next</a><h2>Gamboling With Slots</h2><ul> 8 <a accesskey="P" href="pyobjects-4.html">Prev</a> | <a href="pyobjects-0.html">Index</a> | <a acesskey="N" href="pyobjects-6.html">Next</a><h2>Ints</h2><ul> 9 <li>For efficiency, ints are not malloc'ed singly but in PyIntBlocks.</li> 10 11 <li>Ints are replaced by Longs in 3.0 -- malloc list is gone.</li> 12 13 <li><div class="highlight"><pre><span class="go">Python 2.6a3+ (trunk:64269M, Jun 14 2008, 11:36:56) </span> 14 <span class="gp">>>> </span><span class="n">util</span><span class="o">.</span><span class="n">memory</span><span class="p">()</span> 15 <span class="go">5849088.0</span> 16 <span class="gp">>>> </span><span class="n">z</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="mf">1000000</span><span class="p">))</span> 17 <span class="gp">>>> </span><span class="n">util</span><span class="o">.</span><span class="n">memory</span><span class="p">()</span> 18 <span class="go">22380544.0</span> 19 <span class="gp">>>> </span><span class="k">del</span> <span class="n">z</span> 20 <span class="gp">>>> </span><span class="n">util</span><span class="o">.</span><span class="n">memory</span><span class="p">()</span> 21 <span class="go">17879040.0</span> 22 </pre></div> 23 </li> 24 25 <li><div class="highlight"><pre><span class="go">Python 3.0a5+ (py3k:64080, Jun 10 2008, 18:22:21)</span> 26 <span class="gp">>>> </span><span class="n">util</span><span class="o">.</span><span class="n">memory</span><span class="p">()</span> 27 <span class="go">9302016.0</span> 28 <span class="gp">>>> </span><span class="n">z</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="mf">1000000</span><span class="p">))</span> 29 <span class="gp">>>> </span><span class="n">util</span><span class="o">.</span><span class="n">memory</span><span class="p">()</span> 30 <span class="go">29011968.0</span> 31 <span class="gp">>>> </span><span class="k">del</span> <span class="n">z</span> 32 <span class="gp">>>> </span><span class="n">util</span><span class="o">.</span><span class="n">memory</span><span class="p">()</span> 33 <span class="go">9302016.0</span> 34 </pre></div> 35 </li> 9 36 </ul> 10 37 <br /><div class="footer"><hr />Everything You Didn't Want to Known About Python Objects</div></body></html> -
hodgestar/Talks/PythonObjects/html/pyobjects-6.html
r335 r337 6 6 </head> 7 7 <body> 8 <a accesskey="P" href="pyobjects-5.html">Prev</a> | <a href="pyobjects-0.html">Index</a> | <a acesskey="N" href="pyobjects-7.html">Next</a><h2>PyObject C API</h2><ul> 9 <li>List of methods unchanged between 2.5 and 2.6</li> 8 <a accesskey="P" href="pyobjects-5.html">Prev</a> | <a href="pyobjects-0.html">Index</a> | <a acesskey="N" href="pyobjects-7.html">Next</a><h2>Int (speed)</h2><ul> 9 <li><div class="highlight"><pre><span class="go">$ ./python -m timeit "list(x for x in range(2**30,2**30+1000))"</span> 10 <span class="go">10000 loops, best of 3: 176 usec per loop</span> 11 <span class="go">$ ../py3k/python -m timeit "list(x for x in range(2**30,2**30+1000))"</span> 12 <span class="go">1000 loops, best of 3: 202 usec per loop</span> 13 <span class="go">$ ./python -m timeit "list(x for x in range(2**37,2**37+1000))"</span> 14 <span class="go">1000 loops, best of 3: 311 usec per loop</span> 15 <span class="go">$ ../py3k/python -m timeit "list(x for x in range(2**37,2**37+1000))"</span> 16 <span class="go">1000 loops, best of 3: 431 usec per loop</span> 17 <span class="go">$ ./python -m timeit "list(x for x in range(2**63,2**63+1000))"</span> 18 <span class="go">1000 loops, best of 3: 320 usec per loop</span> 19 <span class="go">$ ../py3k/python -m timeit "list(x for x in range(2**63,2**63+1000))"</span> 20 <span class="go">1000 loops, best of 3: 439 usec per loop</span> 21 </pre></div> 22 </li> 10 23 </ul> 11 24 <br /><div class="footer"><hr />Everything You Didn't Want to Known About Python Objects</div></body></html> -
hodgestar/Talks/PythonObjects/html/pyobjects-7.html
r334 r337 6 6 </head> 7 7 <body> 8 <a accesskey="P" href="pyobjects-6.html">Prev</a> | <a href="pyobjects-0.html">Index</a> | <a acesskey="N" href="pyobjects-8.html">Next</a><h2>object.c</h2><ul> 9 <li><img src='tabs.png' alt='' /></li> 8 <a accesskey="P" href="pyobjects-6.html">Prev</a> | <a href="pyobjects-0.html">Index</a> | <a acesskey="N" href="pyobjects-8.html">Next</a><h2>Gamboling With Slots</h2><ul> 10 9 </ul> 11 10 <br /><div class="footer"><hr />Everything You Didn't Want to Known About Python Objects</div></body></html> -
hodgestar/Talks/PythonObjects/html/pyobjects-8.html
r335 r337 6 6 </head> 7 7 <body> 8 <a accesskey="P" href="pyobjects-7.html">Prev</a> | <a href="pyobjects-0.html">Index</a> | Next<h2>New Python Documents - ZOMG!</h2><ul> 9 <li>Interactive search -- in static HTML.</li> 10 11 <li>_static/searchindex.json</li> 12 13 <li><a href="file:///home/simon/LocalProjects/PythonSpint/trunk/Doc/build/html/index.html">file:///home/simon/LocalProjects/PythonSpint/trunk/Doc/build/html/index.html</a></li> 8 <a accesskey="P" href="pyobjects-7.html">Prev</a> | <a href="pyobjects-0.html">Index</a> | <a acesskey="N" href="pyobjects-9.html">Next</a><h2>PyObject C API</h2><ul> 9 <li>List of methods unchanged between 2.5 and 2.6</li> 14 10 </ul> 15 11 <br /><div class="footer"><hr />Everything You Didn't Want to Known About Python Objects</div></body></html> -
hodgestar/Talks/PythonObjects/pyobjects.py
r335 r337 1 from slides import Lecture, Slide, TitleSlide, Bullet, PRE, URL, Image, cgi1 from slides import Lecture, Slide, TitleSlide, Bullet, PRE, URL, Image, SubBullet, cgi 2 2 from pygments.lexers import get_lexer_by_name 3 3 from pygments.formatters import get_formatter_by_name … … 103 103 Bullet("Single characters and empty string held in permament cache (Objects/stringobject.c)."), 104 104 Bullet("Constants strings of size <= 20 cache by parser (TODO: check)."), 105 Bullet("PyString_InternInPlace (PyUnicode_InternInPlace in 3.0) results in strings being stored in internal dictionary.", 106 SubBullet( 107 Bullet("Reference in interned not counted in reference count (nasty hack to hide this from users)."), 108 ), 109 ), 110 Bullet("Strings are replaced by Unicode in 3.0"), 105 111 ), 106 112 Slide("Find Big Dict", … … 119 125 >>> import util 120 126 >>> util.keyword_quiz() 127 """)), 128 ), 129 Slide("Ints", 130 Bullet("For efficiency, ints are not malloc'ed singly but in PyIntBlocks."), 131 Bullet("Ints are replaced by Longs in 3.0 -- malloc list is gone."), 132 Bullet(PYCON(""" 133 Python 2.6a3+ (trunk:64269M, Jun 14 2008, 11:36:56) 134 >>> util.memory() 135 5849088.0 136 >>> z = list(range(1000000)) 137 >>> util.memory() 138 22380544.0 139 >>> del z 140 >>> util.memory() 141 17879040.0 142 """)), 143 Bullet(PYCON(""" 144 Python 3.0a5+ (py3k:64080, Jun 10 2008, 18:22:21) 145 >>> util.memory() 146 9302016.0 147 >>> z = list(range(1000000)) 148 >>> util.memory() 149 29011968.0 150 >>> del z 151 >>> util.memory() 152 9302016.0 153 """)), 154 ), 155 Slide("Int (speed)", 156 Bullet(PYCON(""" 157 $ ./python -m timeit "list(x for x in range(2**30,2**30+1000))" 158 10000 loops, best of 3: 176 usec per loop 159 $ ../py3k/python -m timeit "list(x for x in range(2**30,2**30+1000))" 160 1000 loops, best of 3: 202 usec per loop 161 $ ./python -m timeit "list(x for x in range(2**37,2**37+1000))" 162 1000 loops, best of 3: 311 usec per loop 163 $ ../py3k/python -m timeit "list(x for x in range(2**37,2**37+1000))" 164 1000 loops, best of 3: 431 usec per loop 165 $ ./python -m timeit "list(x for x in range(2**63,2**63+1000))" 166 1000 loops, best of 3: 320 usec per loop 167 $ ../py3k/python -m timeit "list(x for x in range(2**63,2**63+1000))" 168 1000 loops, best of 3: 439 usec per loop 121 169 """)), 122 170 ),
