WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
44884
Improve BlobBuilder to combine adjacent strings
https://bugs.webkit.org/show_bug.cgi?id=44884
Summary
Improve BlobBuilder to combine adjacent strings
Jian Li
Reported
2010-08-30 12:14:47 PDT
Improve BlobBuilder to combine adjacent strings.
Attachments
Proposed Patch
(1.77 KB, patch)
2010-08-30 12:16 PDT
,
Jian Li
fishd
: review+
jianli
: commit-queue-
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Jian Li
Comment 1
2010-08-30 12:16:06 PDT
Created
attachment 65936
[details]
Proposed Patch
Kinuko Yasuda
Comment 2
2010-08-30 12:51:03 PDT
(In reply to
comment #1
)
> Created an attachment (id=65936) [details] > Proposed Patch
I wonder if this may end up copying strings too many times. What if the user script calls blobBuilder.append(string) hundreds of times? Can't we put a FIXME to optimize the performance later or isn't it better to concatenate the strings at once on getBlob()?
Jian Li
Comment 3
2010-08-31 10:24:19 PDT
Committed as
http://trac.webkit.org/changeset/66499
.
Jian Li
Comment 4
2010-08-31 10:24:58 PDT
(In reply to
comment #2
)
> (In reply to
comment #1
) > > Created an attachment (id=65936) [details] [details] > > Proposed Patch > > I wonder if this may end up copying strings too many times. > What if the user script calls blobBuilder.append(string) hundreds of times? > Can't we put a FIXME to optimize the performance later or isn't it better to concatenate the strings at once on getBlob()?
I think it is fine since this is what we also do for combining string in form data.
Kinuko Yasuda
Comment 5
2010-08-31 13:28:05 PDT
(In reply to
comment #4
)
> (In reply to
comment #2
) > > (In reply to
comment #1
) > > > Created an attachment (id=65936) [details] [details] [details] > > > Proposed Patch > > > > I wonder if this may end up copying strings too many times. > > What if the user script calls blobBuilder.append(string) hundreds of times? > > Can't we put a FIXME to optimize the performance later or isn't it better to concatenate the strings at once on getBlob()? > > I think it is fine since this is what we also do for combining string in form data.
Do you mean FormData::appendData()? It calls Vector.grow() which utilizes memory (slightly) more efficiently and does not copy the original data if the new size fits in the reserved capacity. (I was wondering why we don't simply use Vector.append() though.) In this patch every time we call append we copy both original and new strings. It may make sense in a bigger redesign but I don't quite get it why we needed this particular small change separately.
Michael Nordman
Comment 6
2010-08-31 13:50:43 PDT
> > > I wonder if this may end up copying strings too many times. > > > What if the user script calls blobBuilder.append(string) hundreds of times? > > > Can't we put a FIXME to optimize the performance later or isn't it better to concatenate the strings at once on getBlob()? > > > > I think it is fine since this is what we also do for combining string in form data. > > Do you mean FormData::appendData()? > It calls Vector.grow() which utilizes memory (slightly) more efficiently and does not copy the original data if the new size fits in the reserved capacity. (I was wondering why we don't simply use Vector.append() though.) > In this patch every time we call append we copy both original and new strings. > It may make sense in a bigger redesign but I don't quite get it why we needed this particular small change separately.
I agree with kinuko about this particular patch not really helping the matter. Maybe we should leave the code as is until something more thoughtful is put together.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug