[PATCH 0 of 5] using ctypes on Windows

Adrian Buehlmann adrian at cadifra.com
Thu Feb 10 12:40:32 CST 2011


On 2011-02-08 19:05, Adrian Buehlmann wrote:
> On 2011-02-08 18:05, Mads Kiilerich wrote:
>> On 02/08/2011 05:52 PM, Adrian Buehlmann wrote:
>>> The first patch ports win32.py to using Python's ctypes library
>>> on Windows (replacing pywin32).
>>
>> Has it been benchmarked?
> 
> I've seen no noticeable slowdown.

Two samples of 'hg clone' which confirm this:

Without the patches:

  $ hgc --time --profile clone -U --debug xen-3.4-testing.hg xen1
  --- running hg from C:\Users\adi\hgrepos\hg-crew
  linked 10722 files
     CallCount    Recursive    Total(ms)   Inline(ms) module:lineno(function)
         10722            0      2.2641      2.2641   <win32file.CreateHardLink>
         12259            0      1.1405      1.1405   <nt.stat>
          1507            0      0.2817      0.2817   <nt.mkdir>
        159569       119698      0.2786      0.2156   mercurial.demandimport:72(__getattribute__)
        +79768            0      0.0858      0.0858   +mercurial.demandimport:72(__getattribute__)
        +39884           13      0.0845      0.0290   +mercurial.demandimport:44(_load)
        +39884            0      0.0104      0.0104   +<getattr>
         12226        12218      4.3175      0.1186   mercurial.util:458(copyfiles)
         +1504            0      0.2810      0.2810   +<nt.mkdir>
        +12218        12163      4.3109      0.1182   +mercurial.util:458(copyfiles)
         +1504            0      0.1083      0.1083   +<mercurial.osutil.listdir>
        +39673            0      0.2534      0.0974   +mercurial.demandimport:72(__getattribute__)
        +24436            0      0.0973      0.0592   +ntpath:63(join)
          1504            0      0.1083      0.1083   <mercurial.osutil.listdir>
         24477            0      0.0974      0.0593   ntpath:63(join)
        +24477            0      0.0341      0.0223   +ntpath:55(isabs)
        +24477            0      0.0041      0.0041   +<len>
         39884           13      0.0845      0.0290   mercurial.demandimport:44(_load)
        +39917            0      0.0318      0.0318   +mercurial.demandimport:72(__getattribute__)
           +33            9      0.0238      0.0107   +<__import__>
           +33            0      0.0000      0.0000   +<method 'get' of 'dict' objects>
         12231            0      1.1787      0.0244   genericpath:38(isdir)
        +12231            0      1.1389      1.1389   +<nt.stat>
        +12230            0      0.0154      0.0100   +stat:40(S_ISDIR)
         24480            0      0.0341      0.0223   ntpath:55(isabs)
        +24480            0      0.0118      0.0118   +ntpath:122(splitdrive)
  Time: real 4.388 secs (user 0.811+0.000 sys 3.182+0.000)

With the patches:

  $ hgc --time --profile clone -U --debug xen-3.4-testing.hg xen1
  --- running hg from C:\Users\adi\hgrepos\hg-crew
  linked 10722 files
     CallCount    Recursive    Total(ms)   Inline(ms) module:lineno(function)
         10722            0      2.0737      2.0736   mercurial.win32:140(os_link)
            +1            0      0.0000      0.0000   +ctypes:363(__getattr__)
         12259            0      1.1350      1.1350   <nt.stat>
          1507            0      0.4359      0.4359   <nt.mkdir>
        153527       115166      0.2638      0.2040   mercurial.demandimport:72(__getattribute__)
        +76748            0      0.0808      0.0808   +mercurial.demandimport:72(__getattribute__)
        +38374           13      0.0801      0.0277   +mercurial.demandimport:44(_load)
        +38374            0      0.0099      0.0099   +<getattr>
         12226        12218      4.2454      0.1198   mercurial.util:458(copyfiles)
        +10722            0      2.0737      2.0736   +mercurial.win32:140(os_link)
         +1504            0      0.4352      0.4352   +<nt.mkdir>
        +12218        12163      4.2415      0.1194   +mercurial.util:458(copyfiles)
         +1504            0      0.1071      0.1071   +<mercurial.osutil.listdir>
        +38169            0      0.2402      0.0926   +mercurial.demandimport:72(__getattribute__)
          1504            0      0.1071      0.1071   <mercurial.osutil.listdir>
         24477            0      0.0959      0.0579   ntpath:63(join)
        +24477            0      0.0340      0.0222   +ntpath:55(isabs)
        +24477            0      0.0040      0.0040   +<len>
         38374           13      0.0801      0.0277   mercurial.demandimport:44(_load)
        +38405            0      0.0301      0.0301   +mercurial.demandimport:72(__getattribute__)
           +31            9      0.0224      0.0092   +<__import__>
           +31            0      0.0000      0.0000   +<method 'get' of 'dict' objects>
         12231            0      1.1738      0.0249   genericpath:38(isdir)
        +12231            0      1.1334      1.1334   +<nt.stat>
        +12230            0      0.0154      0.0102   +stat:40(S_ISDIR)
         24480            0      0.0340      0.0222   ntpath:55(isabs)
        +24480            0      0.0118      0.0118   +ntpath:122(splitdrive)
  Time: real 4.313 secs (user 0.998+0.000 sys 2.761+0.000)




More information about the Mercurial-devel mailing list