1. 21 4月, 2018 1 次提交
    • 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
  2. 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
  3. 19 4月, 2018 5 次提交
  4. 18 4月, 2018 4 次提交
  5. 16 4月, 2018 3 次提交
  6. 14 4月, 2018 3 次提交
  7. 13 4月, 2018 3 次提交
  8. 11 4月, 2018 4 次提交
  9. 10 4月, 2018 5 次提交
  10. 05 4月, 2018 3 次提交
  11. 04 4月, 2018 5 次提交
  12. 03 4月, 2018 1 次提交
  13. 28 3月, 2018 1 次提交