forked from mia/Aegisub
Greatly improved I/O speed on gorgonsub
Originally committed to SVN as r2053.
This commit is contained in:
parent
521632cd9b
commit
108671175c
3 changed files with 18 additions and 7 deletions
|
@ -59,8 +59,9 @@ ActionListPtr Controller::CreateActionList(const String title,const String owner
|
||||||
void Controller::LoadFile(const String filename,const String encoding)
|
void Controller::LoadFile(const String filename,const String encoding)
|
||||||
{
|
{
|
||||||
const FormatPtr handler = FormatManager::GetFormatFromFilename(filename,true);
|
const FormatPtr handler = FormatManager::GetFormatFromFilename(filename,true);
|
||||||
wxFileInputStream stream(filename);
|
wxFFileInputStream stream(filename);
|
||||||
model.Load(stream,handler,encoding);
|
wxBufferedInputStream buffer(stream);
|
||||||
|
model.Load(buffer,handler,encoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,8 +70,9 @@ void Controller::LoadFile(const String filename,const String encoding)
|
||||||
void Controller::SaveFile(const String filename,const String encoding)
|
void Controller::SaveFile(const String filename,const String encoding)
|
||||||
{
|
{
|
||||||
const FormatPtr handler = FormatManager::GetFormatFromFilename(filename,true);
|
const FormatPtr handler = FormatManager::GetFormatFromFilename(filename,true);
|
||||||
wxFileOutputStream stream(filename);
|
wxFFileOutputStream stream(filename);
|
||||||
model.Save(stream,handler,encoding);
|
wxBufferedOutputStream buffer(stream);
|
||||||
|
model.Save(buffer,handler,encoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include <aegilib/gorgonsub.h>
|
#include <aegilib/gorgonsub.h>
|
||||||
#include <wx/wfstream.h>
|
#include <wx/wfstream.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <wx/stopwatch.h>
|
||||||
#include "text_file_reader.h"
|
#include "text_file_reader.h"
|
||||||
#include "text_file_writer.h"
|
#include "text_file_writer.h"
|
||||||
|
|
||||||
|
@ -53,11 +54,14 @@ int main () {
|
||||||
// Subtitles model
|
// Subtitles model
|
||||||
Model subs;
|
Model subs;
|
||||||
Controller control(subs);
|
Controller control(subs);
|
||||||
|
wxStopWatch timer;
|
||||||
|
|
||||||
// Load subtitles
|
// Load subtitles
|
||||||
cout << "Loading file... ";
|
cout << "Loading file... ";
|
||||||
|
timer.Start();
|
||||||
control.LoadFile(L"subs_in.ass",L"UTF-8");
|
control.LoadFile(L"subs_in.ass",L"UTF-8");
|
||||||
cout << "Done.\n";
|
timer.Pause();
|
||||||
|
cout << "Done in " << timer.Time() << "ms.\n";
|
||||||
|
|
||||||
// Create line to be inserted
|
// Create line to be inserted
|
||||||
cout << "Creating data... ";
|
cout << "Creating data... ";
|
||||||
|
@ -67,11 +71,13 @@ int main () {
|
||||||
|
|
||||||
// Create action list
|
// Create action list
|
||||||
cout << "Processing actions... ";
|
cout << "Processing actions... ";
|
||||||
|
timer.Start();
|
||||||
ActionListPtr actions = control.CreateActionList(L"Insert line");
|
ActionListPtr actions = control.CreateActionList(L"Insert line");
|
||||||
actions->InsertLine(line,2);
|
actions->InsertLine(line,2);
|
||||||
actions->RemoveLine(3,L"Events");
|
actions->RemoveLine(3,L"Events");
|
||||||
actions->Finish();
|
actions->Finish();
|
||||||
cout << "Done.\n";
|
timer.Pause();
|
||||||
|
cout << "Done in " << timer.Time() << "ms.\n";
|
||||||
|
|
||||||
// Save subtitles
|
// Save subtitles
|
||||||
cout << "Saving file... ";
|
cout << "Saving file... ";
|
||||||
|
@ -95,8 +101,10 @@ int main () {
|
||||||
|
|
||||||
// Save subtitles
|
// Save subtitles
|
||||||
cout << "Saving file... ";
|
cout << "Saving file... ";
|
||||||
|
timer.Start();
|
||||||
control.SaveFile(L"subs_out.ass",L"UTF-8");
|
control.SaveFile(L"subs_out.ass",L"UTF-8");
|
||||||
cout << "Done.\n";
|
timer.Pause();
|
||||||
|
cout << "Done in " << timer.Time() << "ms.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (std::exception &e) {
|
catch (std::exception &e) {
|
||||||
|
|
|
@ -143,6 +143,7 @@
|
||||||
OptimizeReferences="2"
|
OptimizeReferences="2"
|
||||||
EnableCOMDATFolding="2"
|
EnableCOMDATFolding="2"
|
||||||
TargetMachine="1"
|
TargetMachine="1"
|
||||||
|
Profile="true"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCALinkTool"
|
Name="VCALinkTool"
|
||||||
|
|
Loading…
Reference in a new issue