Merge pull request #105 from NN---/unordered_map

[ENHANCEMENT] Use unordered_map instead map for better performance.
pull/156/head
Don HO 10 years ago
commit aa944fdfe3

@ -669,8 +669,8 @@ protected:
bool _lineNumbersShown; bool _lineNumbersShown;
bool _wrapRestoreNeeded; bool _wrapRestoreNeeded;
typedef std::map<int, Style> StyleMap; typedef std::unordered_map<int, Style> StyleMap;
typedef std::map<BufferID, StyleMap*> BufferStyleMap; typedef std::unordered_map<BufferID, StyleMap*> BufferStyleMap;
BufferStyleMap _hotspotStyles; BufferStyleMap _hotspotStyles;
int _beginSelectPosition; int _beginSelectPosition;

@ -1641,7 +1641,7 @@ INT_PTR CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPAR
dlg->_pFgColour->display(); dlg->_pFgColour->display();
dlg->_pBgColour->display(); dlg->_pBgColour->display();
map<int, int>::iterator iter = globalMappper().nestingMapper.begin(); unordered_map<int, int>::iterator iter = globalMappper().nestingMapper.begin();
for (; iter != globalMappper().nestingMapper.end(); ++iter) for (; iter != globalMappper().nestingMapper.end(); ++iter)
{ {
::SendDlgItemMessage(hwnd, iter->first, BM_SETCHECK, style._nesting & iter->second, 0); ::SendDlgItemMessage(hwnd, iter->first, BM_SETCHECK, style._nesting & iter->second, 0);
@ -1730,7 +1730,7 @@ INT_PTR CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPAR
style._fontStyle |= FONTSTYLE_UNDERLINE; style._fontStyle |= FONTSTYLE_UNDERLINE;
style._nesting = SCE_USER_MASK_NESTING_NONE; style._nesting = SCE_USER_MASK_NESTING_NONE;
map<int, int>::iterator iter = globalMappper().nestingMapper.begin(); unordered_map<int, int>::iterator iter = globalMappper().nestingMapper.begin();
for (; iter != globalMappper().nestingMapper.end(); ++iter) for (; iter != globalMappper().nestingMapper.end(); ++iter)
{ {
if (BST_CHECKED == ::SendMessage(::GetDlgItem(hwnd, iter->first), BM_GETCHECK, 0, 0)) if (BST_CHECKED == ::SendMessage(::GetDlgItem(hwnd, iter->first), BM_GETCHECK, 0, 0))

@ -51,7 +51,7 @@ static int max(int a, int b) {
#endif //__GNUC__ #endif //__GNUC__
#include "tchar.h" #include "tchar.h"
#include "scilexer.h" #include "scilexer.h"
#include <map> #include <unordered_map>
class ScintillaEditView; class ScintillaEditView;
class UserLangContainer; class UserLangContainer;
@ -66,18 +66,18 @@ class GlobalMappers
{ {
public: public:
std::map<generic_string, int> keywordIdMapper; std::unordered_map<generic_string, int> keywordIdMapper;
std::map<int, generic_string> keywordNameMapper; std::unordered_map<int, generic_string> keywordNameMapper;
std::map<generic_string, int> styleIdMapper; std::unordered_map<generic_string, int> styleIdMapper;
std::map<int, generic_string> styleNameMapper; std::unordered_map<int, generic_string> styleNameMapper;
std::map<generic_string, int> temp; std::unordered_map<generic_string, int> temp;
std::map<generic_string, int>::iterator iter; std::unordered_map<generic_string, int>::iterator iter;
std::map<int, int> nestingMapper; std::unordered_map<int, int> nestingMapper;
std::map<int, int> dialogMapper; std::unordered_map<int, int> dialogMapper;
std::map<int, std::string> setLexerMapper; std::unordered_map<int, std::string> setLexerMapper;
// only default constructor is needed // only default constructor is needed
GlobalMappers() GlobalMappers()

Loading…
Cancel
Save