beremiz

a66062a205ae
Build by default with optimization level -O2 for GCC

before -O0 was used by default, that caused pretty bad performance.

Amd64, i6700k, 4200MHz, GNU/Linux (non-RT kernel), gcc 7.2.0

-------------------------------------
Optimization | EN/ENO |no EN/ENO |
-------------------------------------
default | 11 | 9.5 |
-O3 | 3.9 | 5.2 |
-O2 | 4 | 4.8 |
-Os | 4.1 | 3.5 |
-Ofast | 3.9 | 5.2 |
-------------------------------------

ARM, BBB Cortex-A8, 600Mhz, GNU/Linux, gcc 4.6.3

-------------------------------------
Optimization | EN/ENO |no EN/ENO |
-------------------------------------
default | 273 | 226 |
-O3 | 141.8 | 106.2 |
-O2 | 142 | 107 |
-Os | 152.5 | 112.2 |
-Ofast | 141.7 | 106.2 |
-------------------------------------

For embedded systems with size constaints (like Cortex-Mx, AVR and so
on) I usually use -Os. It gets pretty good results. For
GNU/Linux-based systems -O2 is usually a good choice, as you see the
test results.
import wx
from zope.interface import Interface, Attribute
from zope.interface.verify import verifyObject
from connectors import connectors_dialog, ConnectorDialog, GetConnectorFromURI
[ID_URIWIZARDDIALOG,ID_URITYPECHOICE] = [wx.NewId() for _init_ctrls in range(2)]
class IConnectorPanel(Interface):
"""This is interface for panel of seperate connector type"""
uri = Attribute("""uri of connections""")
type = Attribute("""type of connector""")
def SetURI(uri):
"""methode for set uri"""
def GetURI():
"""metohde for get uri"""
class UriLocationEditor(wx.Dialog):
def _init_ctrls(self, parent):
wx.Dialog.__init__(self, id=ID_URIWIZARDDIALOG,
name='UriLocationEditor', parent=parent,
title='Uri location')
self.UriTypeChoice = wx.Choice(parent=self, id=ID_URIWIZARDDIALOG, choices = self.URITYPES)
self.UriTypeChoice.SetSelection(0)
self.Bind(wx.EVT_CHOICE, self.OnTypeChoice, self.UriTypeChoice)
self.PanelSizer = wx.BoxSizer(wx.HORIZONTAL)
self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL)
def _init_sizers(self):
self.mainSizer = wx.BoxSizer(wx.VERTICAL)
typeSizer = wx.BoxSizer(wx.HORIZONTAL)
typeSizer.Add(wx.StaticText(self,wx.ID_ANY,"URI type:"), border=5, flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL)
typeSizer.Add(self.UriTypeChoice, border=5, flag=wx.ALL)
self.mainSizer.Add(typeSizer)
self.mainSizer.Add(self.PanelSizer, border=5, flag=wx.ALL)
self.mainSizer.Add(self.ButtonSizer, border=5, flag=wx.BOTTOM|wx.ALIGN_CENTER_HORIZONTAL)
self.SetSizer(self.mainSizer)
def __init__(self, parent, uri):
self.URITYPES = ["- Select URI type -"]
for connector_type, connector_function in connectors_dialog.iteritems():
try:
connector_function['function']()
self.URITYPES.append(connector_type)
except Exception as e:
pass
self.selected = None
self.parrent = parent
self.logger = self.parrent.CTR.logger
self._init_ctrls(parent)
self._init_sizers()
self.SetURI(uri)
self.CenterOnParent()
def OnTypeChoice(self, event):
self._removePanelType()
index = event.GetSelection()
if index > 0:
self.selected = event.GetString()
self.panelType = self._getConnectorDialog(self.selected)
if self.panelType:
self.PanelSizer.Add(self.panelType)
self.mainSizer.Layout()
self.Fit()
self.panelType.Refresh()
def SetURI(self, uri):
self._removePanelType()
uri_list = uri.strip().split(":")
if uri_list:
uri_type = uri_list[0].upper()
type = GetConnectorFromURI(uri_type)
if type:
self.selected = type
self.UriTypeChoice.SetStringSelection(self.selected)
self.panelType = self._getConnectorDialog(self.selected)
if self.panelType:
self.panelType.SetURI(uri)
self.PanelSizer.Add(self.panelType)
self.PanelSizer.Layout()
self.mainSizer.Layout()
self.Fit()
self.panelType.Refresh()
def GetURI(self):
if not self.selected or not self.panelType:
return ""
else:
return self.panelType.GetURI()
def _removePanelType(self):
for i in range(self.PanelSizer.GetItemCount()):
item = self.PanelSizer.GetItem(i)
item.DeleteWindows()
self.PanelSizer.Remove(i)
self.Fit()
self.PanelSizer.Layout()
def _getConnectorDialog(self, connectorType):
connector = ConnectorDialog(connectorType, self)
if connector and IConnectorPanel.providedBy(connector):
if verifyObject(IConnectorPanel, connector):
return connector
else:
return None