Aiur – ZelluX 的技术博客

Security, Kernel, Virtualization, Programming Languages

Charming Python: Reloading on the fly

110 views | without comments

http://www.ibm.com/developerworks/library/l-py-fly.html

刚看到标题的时候还以为是做live updating的,其实比这个简单多了,就是每次运行某个函数的时候先check下这个函数的最新版本,有新版本的话就更新当前函数。

这样做至少有两个问题:

1. overhead比较严重,每次调用函数都要多个判断(不过应该可以采用类似linux源代码中unlikely()宏的做法,这样branch misprediction的几率比较小,流水线不至于被打断)。

2. 必须事先知道哪些函数会被patch,用一个wrapper函数包装起来。

Related Posts

Written by zellux

October 6th, 2008 at 9:34 pm

Posted in Programming

Tagged with

Leave a Reply

FireStats icon Powered by FireStatsBetter Tag Cloud