Re: [PATCH 12/12] docs: kdoc: Improve the output text accumulation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Em Thu, 10 Jul 2025 10:19:31 +0200
Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> escreveu:

> Em Thu, 10 Jul 2025 09:13:52 +0200
> Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> escreveu:
> 

> Heh, on those times where LLM can quickly code trivial things for us,
> I actually decided to test 3 different variants:
> 
> - using string +=
> - using list append
> - using __add__
> - using __iadd__

Manually reorganized the LLM-generated code, in order to get more
precise results. Script enclosed at the end.

  $ for i in python3.9 python3.13 python3.13t; do echo "  $i:"; $i /tmp/bench.py 100000 10 1; $i /tmp/bench.py 1000 1000 1; done
  python3.9:
    10 strings in a loop with 100000 interactions, repeating 24 times
        str +=       : time: 25.21
        list join    : time: 72.65: 188.18% slower than str +=
        __add__      : time: 71.82: 184.88% slower than str +=
        __iadd__     : time: 67.84: 169.09% slower than str +=
    1000 strings in a loop with 1000 interactions, repeating 24 times
        str +=       : time: 24.29
        list join    : time: 58.76: 141.88% slower than str +=
        __add__      : time: 58.68: 141.54% slower than str +=
        __iadd__     : time: 55.48: 128.37% slower than str +=
  python3.13:
    10 strings in a loop with 100000 interactions, repeating 24 times
        str +=       : time: 28.01
        list join    : time: 32.46: 15.91% slower than str +=
        __add__      : time: 52.56: 87.66% slower than str +=
        __iadd__     : time: 58.69: 109.55% slower than str +=
    1000 strings in a loop with 1000 interactions, repeating 24 times
        str +=       : time: 22.03
        list join    : time: 23.38: 6.12% slower than str +=
        __add__      : time: 44.25: 100.86% slower than str +=
        __iadd__     : time: 40.70: 84.74% slower than str +=
  python3.13t:
    10 strings in a loop with 100000 interactions, repeating 24 times
        str +=       : time: 25.65
        list join    : time: 74.95: 192.18% slower than str +=
        __add__      : time: 83.04: 223.71% slower than str +=
        __iadd__     : time: 79.07: 208.23% slower than str +=
    1000 strings in a loop with 1000 interactions, repeating 24 times
        str +=       : time: 57.39
        list join    : time: 62.31: 8.58% slower than str +=
        __add__      : time: 70.65: 23.10% slower than str +=
        __iadd__     : time: 68.67: 19.65% slower than str +=


[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux