由买买提看人间百态

topics

全部话题 - 话题: refcnt
(共0页)
L***s
发帖数: 1148
1
来自主题: Programming版 - Google了一下为啥Python留着GIL

As far as I know, refcnt is a major reason, but not the whole story.
Python (as well as Ruby) VM bytecodes are simply way too high level
for any finer-grain locks to be useful.
PyPy, another Python implementation that trace-JITs the interpreter
itself instead of the Python program, does not support refcnt semantics
--it uses multiple gc algorithms, with minimark being the default one--
but it still has GIL present, for many reasons.
You may take a look at their STM proposal to get some ideas
ht... 阅读全帖
e*******o
发帖数: 4654
2
来自主题: Programming版 - perl sprintf question converting dec to hex
1.
➜ perl -MDevel::Peek -E 'Dump(-1)'
SV = IV(0x15f02a0) at 0x15f02b0
REFCNT = 1
FLAGS = (PADTMP,IOK,READONLY,pIOK)
IV = -1
this show -1 is stored as IV internally.
➜ perl -V:ivsize
ivsize='8';
the unit is bytes, so size in bit
ivszie * 8 = 64 .
2. same with C, 1$
http://perldoc.perl.org/functions/sprintf.html
(共0页)