1. 23 4月, 2018 5 次提交
  2. 21 4月, 2018 4 次提交
    • C
      Merge remote-tracking branch 'apahim/utils_cpu' · 510ca7f7
      Cleber Rosa 提交于
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      510ca7f7
    • C
      Merge branch 'optimize_datasize' · 8e2b165b
      Cleber Rosa 提交于
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      8e2b165b
    • A
      DataSize: switch OrderedDict by dict · acc6e360
      Amador Pahim 提交于
      Since we are not using __dir__ anymore to list the available properties,
      the OrderedDict is not needed. And dropping it makes the performance to
      improve.
      
      Before this patch:
      
      >>> timeit.timeit('data_structures.DataSize("1M").b',
                        setup='from avocado.utils import data_structures',
                        number=1000000)
      >>> 1.1071600914001465
      
      After this patch:
      
      >>> timeit.timeit('data_structures.DataSize("1M").b',
                        setup='from avocado.utils import data_structures',
                        number=1000000)
      >>> 0.9833340644836426
      Signed-off-by: NAmador Pahim <apahim@redhat.com>
      acc6e360
    • A
      DataSize: define __slot__ · 0c39028d
      Amador Pahim 提交于
      For small classes, like this one, with known attributes, using dict
      wastes a lot of RAM. Defining __slots__ as a list will save a lot of
      memory, while improving the performance a bit.
      
      Before this patch:
      
      >>> timeit.timeit('data_structures.DataSize("1M").b',
                        setup='from avocado.utils import data_structures',
                        number=1000000)
      >>> 1.1383171081542969
      
      After this patch:
      
      >>> timeit.timeit('data_structures.DataSize("1M").b',
                        setup='from avocado.utils import data_structures',
                        number=1000000)
      >>> 1.1071600914001465
      Signed-off-by: NAmador Pahim <apahim@redhat.com>
      0c39028d
  3. 20 4月, 2018 2 次提交
    • A
      DataSize: replace __getattr__ and __dir__ by actual properties · 970d850a
      Amador Pahim 提交于
      We loose in flexibility by the performance improvement justifies the
      change. Since __getattr__ is the last resource python tries to solve
      attributes, creating the actual properties makes the resolution to
      happen earlier and the performance to be way better.
      
      Before this patch:
      
      >>> timeit.timeit('data_structures.DataSize("1M").b',
                        setup='from avocado.utils import data_structures',
                        number=1000000)
      >>> 2.0695440769195557
      
      After this patch:
      
      >>> timeit.timeit('data_structures.DataSize("1M").b',
                        setup='from avocado.utils import data_structures',
                        number=1000000)
      >>> 1.1383171081542969
      Signed-off-by: NAmador Pahim <apahim@redhat.com>
      970d850a
    • A
      DataSize: simplify __init__ · 5a1b7133
      Amador Pahim 提交于
      Instead of using regex to parse the `data`, let's use a simpler and more
      performatic version witch just handles the last character to figure out
      the unit.
      
      Before this patch:
      
      >>> timeit.timeit('data_structures.DataSize("1M").b',
                        setup='from avocado.utils import data_structures',
                        number=1000000)
      >>> 2.988218069076538
      
      After this patch:
      
      >>> timeit.timeit('data_structures.DataSize("1M").b',
                        setup='from avocado.utils import data_structures',
                        number=1000000)
      >>> 2.0695440769195557
      Signed-off-by: NAmador Pahim <apahim@redhat.com>
      5a1b7133
  4. 19 4月, 2018 6 次提交
  5. 18 4月, 2018 4 次提交
  6. 16 4月, 2018 3 次提交
  7. 14 4月, 2018 3 次提交
  8. 13 4月, 2018 3 次提交
  9. 11 4月, 2018 4 次提交
  10. 10 4月, 2018 5 次提交
  11. 05 4月, 2018 1 次提交