neutron-lib/neutron_lib
Antoni Segura Puimedon b5b7131f4e
net_utils: Speed up mac address generation
Using getrandbits supposes a huge speedup:

Py2
In [2]: %timeit random.randint(0, 0xff)
The slowest run took 28.53 times longer than the fastest.
This could mean that an intermediate result is being cached.
1000000 loops, best of 3: 769 ns per loop

In [3]: %timeit random.getrandbits(8)
The slowest run took 54.81 times longer than the fastest.
This could mean that an intermediate result is being cached.
1000000 loops, best of 3: 126 ns per loop

Py3

In [3]: %timeit random.randint(0, 0xff)
The slowest run took 288.80 times longer than the fastest.
This could mean that an intermediate result is being cached.
1000000 loops, best of 3: 1.15 µs per loop

In [4]: %timeit random.getrandbits(8)
The slowest run took 29.15 times longer than the fastest.
This could mean that an intermediate result is being cached.
10000000 loops, best of 3: 109 ns per loop

Change-Id: Id6b86c7d2cf88feb81b79862d93f8d06aeb8fa63
Signed-off-by: Antoni Segura Puimedon <antonisp@celebdor.com>
2017-10-13 13:32:42 +02:00
..
agent rehome consumed neutron.common.constants 2017-06-21 07:17:06 -06:00
api Merge "bgpvpn-vni api extension" 2017-10-05 09:49:58 +00:00
callbacks Enable module reference 2017-07-05 12:09:10 +09:00
db rehome availability zone API def 2017-08-04 10:51:43 -06:00
exceptions rehome flavor extension API definition 2017-09-18 05:14:30 -06:00
hacking Fix N536 - Use assertIsNone regex 2017-07-13 21:27:35 -04:00
legacy Move some common test and framework goo into neutron-lib 2016-01-29 23:45:49 -07:00
objects Add exception when a synthetic field is invalid 2017-09-06 10:39:35 +01:00
plugins sync plugin common constants 2017-09-21 09:45:53 -06:00
services rehome qos service DriverBase class 2017-06-13 09:06:33 -06:00
tests net_utils: Speed up mac address generation 2017-10-13 13:32:42 +02:00
utils net_utils: Speed up mac address generation 2017-10-13 13:32:42 +02:00
__init__.py Removes unnecessary utf-8 encoding 2016-12-28 17:08:10 +07:00
_i18n.py Update the documentation link for doc migration 2017-07-20 15:46:41 +00:00
_policy.py Revisit exported policy module 2017-01-12 11:41:53 -08:00
constants.py add PROVISIONAL_IPV6_PD_PREFIX to constants 2017-09-22 13:21:03 -06:00
context.py Fix comment in context.py 2017-10-04 18:18:40 +00:00
fixture.py Use flake8-import-order plugin 2017-07-05 00:53:13 -07:00
version.py Setup for devref documentation 2015-12-07 18:50:07 +00:00
worker.py Enable module reference 2017-07-05 12:09:10 +09:00