Some optimizing changes in generateCross function.
We can use caching of generated AllWords.
This commit is contained in:
@@ -159,6 +159,7 @@ void MainFrame::SetGridImage(GridType &grid, size_t w) {
|
||||
void MainFrame::OnbtnGenerateClick(wxCommandEvent &event) {
|
||||
if ( !_isDictLoaded ) {
|
||||
readDict(wxT("big_cross_ru.txt"), _dict);
|
||||
generateAllWords(_dict, _allWords, _transType);
|
||||
_isDictLoaded = true;
|
||||
}
|
||||
|
||||
@@ -170,7 +171,7 @@ void MainFrame::OnbtnGenerateClick(wxCommandEvent &event) {
|
||||
}
|
||||
readGrid(tPath->GetValue(), grid);
|
||||
try{
|
||||
generateCross(grid,_dict,words_out);
|
||||
generateCross(grid, _allWords, _transType, words_out);
|
||||
|
||||
_words.clear();
|
||||
_words = words_out;
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
## Auto Generated makefile by CodeLite IDE
|
||||
## any manual changes will be erased
|
||||
##
|
||||
## Release
|
||||
## Debug
|
||||
ProjectName :=wxCrossGen
|
||||
ConfigurationName :=Release
|
||||
ConfigurationName :=Debug
|
||||
WorkspacePath := "/data/Sync/SyncProjects/CrossGen"
|
||||
ProjectPath := "/data/Sync/SyncProjects/CrossGen/wxCrossGen"
|
||||
IntermediateDirectory :=../Release
|
||||
IntermediateDirectory :=./Debug
|
||||
OutDir := $(IntermediateDirectory)
|
||||
CurrentFileName :=
|
||||
CurrentFilePath :=
|
||||
CurrentFileFullPath :=
|
||||
User :=Aleksey Lobanov
|
||||
Date :=15/06/15
|
||||
Date :=16/06/15
|
||||
CodeLitePath :="/home/alex/.codelite"
|
||||
LinkerName :=/usr/bin/g++-4.8
|
||||
SharedObjectLinkerName :=/usr/bin/g++-4.8 -shared -fPIC
|
||||
@@ -28,14 +28,14 @@ LibraryPathSwitch :=-L
|
||||
PreprocessorSwitch :=-D
|
||||
SourceSwitch :=-c
|
||||
OutputFile :=$(IntermediateDirectory)/$(ProjectName).out
|
||||
Preprocessors :=$(PreprocessorSwitch)NDEBUG
|
||||
Preprocessors :=
|
||||
ObjectSwitch :=-o
|
||||
ArchiveOutputSwitch :=
|
||||
PreprocessOnlySwitch :=-E
|
||||
ObjectsFileList :="wxCrossGen.txt"
|
||||
PCHCompileFlags :=
|
||||
MakeDirCommand :=mkdir -p
|
||||
LinkOptions := -s $(shell wx-config --debug=no --libs --unicode=yes)
|
||||
LinkOptions := $(shell wx-config --debug=yes --libs --unicode=yes)
|
||||
IncludePath := $(IncludeSwitch). $(IncludeSwitch)../src
|
||||
IncludePCH :=
|
||||
RcIncludePath :=
|
||||
@@ -50,8 +50,8 @@ LibPath := $(LibraryPathSwitch).
|
||||
AR := /usr/bin/ar rcu
|
||||
CXX := /usr/bin/g++-4.8
|
||||
CC := /usr/bin/gcc-4.8
|
||||
CXXFLAGS := -std=c++11 -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) $(Preprocessors)
|
||||
CFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) $(Preprocessors)
|
||||
CXXFLAGS := -std=c++11 -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes) $(Preprocessors)
|
||||
CFLAGS := -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes) $(Preprocessors)
|
||||
ASFLAGS :=
|
||||
AS := /usr/bin/as
|
||||
|
||||
@@ -79,7 +79,7 @@ $(OutputFile): $(IntermediateDirectory)/.d $(Objects)
|
||||
$(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions)
|
||||
|
||||
$(IntermediateDirectory)/.d:
|
||||
@test -d ../Release || $(MakeDirCommand) ../Release
|
||||
@test -d ./Debug || $(MakeDirCommand) ./Debug
|
||||
|
||||
PreBuild:
|
||||
|
||||
@@ -101,6 +101,6 @@ $(IntermediateDirectory)/main.cpp$(PreprocessSuffix): main.cpp
|
||||
## Clean
|
||||
##
|
||||
clean:
|
||||
$(RM) -r ../Release/
|
||||
$(RM) -r ./Debug/
|
||||
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
../Release/main.cpp.o
|
||||
./Debug/main.cpp.o
|
||||
|
||||
@@ -1,13 +1,4 @@
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// generated by wxGlade 0.6.8 on Wed May 20 12:40:03 2015
|
||||
//
|
||||
// Example for compiling a single file project under Linux using g++:
|
||||
// g++ MyApp.cpp $(wx-config --libs) $(wx-config --cxxflags) -o MyApp
|
||||
//
|
||||
// Example for compiling a multi file project under Linux using g++:
|
||||
// g++ main.cpp $(wx-config --libs) $(wx-config --cxxflags) -o MyApp Dialog1.cpp Frame1.cpp
|
||||
//
|
||||
|
||||
#ifndef WXGUI_HPP
|
||||
#define WXGUI_HPP
|
||||
@@ -24,13 +15,6 @@
|
||||
#endif
|
||||
|
||||
|
||||
// begin wxGlade: ::dependencies
|
||||
// end wxGlade
|
||||
|
||||
// begin wxGlade: ::extracode
|
||||
// end wxGlade
|
||||
|
||||
|
||||
class MainFrame: public wxFrame {
|
||||
public:
|
||||
// begin wxGlade: MainFrame::ids
|
||||
@@ -48,6 +32,8 @@ protected:
|
||||
std::vector<wxString> _words;
|
||||
DictType _dict;
|
||||
bool _isDictLoaded;
|
||||
AllWordsType _allWords;
|
||||
CharsTransType _transType;
|
||||
// begin wxGlade: MainFrame::attributes
|
||||
wxStaticText* label_1;
|
||||
wxTextCtrl* tPath;
|
||||
|
||||
Reference in New Issue
Block a user