[QScintilla] Need to get optimal size of buffer when appen o QScintilla object

Phil Thompson phil at riverbankcomputing.com
Fri Jun 10 16:40:03 BST 2016


On 8 Jun 2016, at 5:42 am, Roshni Lalwani <roshiba81 at gmail.com> wrote:
> 
> I want to know what is optimal size of bufferSize  in following code
> 
> class myView : public QScintilla {
> 
> 
> void myView::readFile(QString ofilename) {
> 
> if (FILE* fp = fopen(ofilename.toLatin1().constData() "r")) {
> 	QTextStream ts(fp, QIODevice::ReadOnly);
>         int bufferSize = 8192;
>         do {
>           QString s =  ts.read(bufferSize);
> 	  append(s);
>         } while(!ts.atEnd());
> 	setModified(FALSE);
> 	UFile::close(fp);
> 	d_filename = ofilename;
> 	emit fileNameChanged(ofilename);
>       }
> 
> }
> }
> so that we do not see any  run time issues 
> 
> On Wed, Jun 8, 2016 at 9:31 AM, Roshni Lalwani <roshiba81 at gmail.com> wrote:
> Hi
>    I have an object Q Scintilla . I want to know what is optimal size of bufferSize  in following code
> 
> if (FILE* fp = fopen(ofilename.toLatin1().constData() "r")) {
> 	QTextStream ts(fp, QIODevice::ReadOnly);
>         int bufferSize = 8192;
>         do {
>           QString s =  ts.read(bufferSize);
> 	  append(s);
>         } while(!ts.atEnd());
> 	setModified(FALSE);
> 	UFile::close(fp);
> 	d_filename = ofilename;
> 	emit fileNameChanged(ofilename);
>       }
> 
> so that we do not see any performance issues 

There is no optimal size - the bigger the better. There will be a point where increasing the size makes no difference but what that is depends on the user's system.

Phil


More information about the QScintilla mailing list