WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
210415
[LFC][TFC] Pre-fill columnIntrinsicWidths vector
https://bugs.webkit.org/show_bug.cgi?id=210415
Summary
[LFC][TFC] Pre-fill columnIntrinsicWidths vector
zalan
Reported
2020-04-12 20:20:53 PDT
it's less error prone than the current append logic.
Attachments
Patch
(9.40 KB, patch)
2020-04-12 20:41 PDT
,
zalan
no flags
Details
Formatted Diff
Diff
Patch
(9.50 KB, patch)
2020-04-13 08:10 PDT
,
zalan
no flags
Details
Formatted Diff
Diff
Patch
(9.50 KB, patch)
2020-04-13 08:12 PDT
,
zalan
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
zalan
Comment 1
2020-04-12 20:41:24 PDT
Created
attachment 396252
[details]
Patch
Sam Weinig
Comment 2
2020-04-12 21:03:38 PDT
Comment on
attachment 396252
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=396252&action=review
> Source/WebCore/layout/tableformatting/TableFormattingContext.cpp:281 > Vector<FormattingContext::IntrinsicWidthConstraints> columnIntrinsicWidths; > + columnIntrinsicWidths.fill({ }, columnList.size());
I think this can be slightly more efficient if you use the Vector constructor that takes a size + value to fill: Vector<FormattingContext::IntrinsicWidthConstraints> columnIntrinsicWidths(columnList.size(), { }); (or, if std::is_pod<FormattingContext::IntrinsicWidthConstraints>::value is true, you can just pass the size).
> Source/WebCore/layout/tableformatting/TableFormattingContext.cpp:341 > Vector<ColumnMinimumWidth> columnMinimumWidths; > + columnMinimumWidths.fill({ }, columns.size());
Same here.
Sam Weinig
Comment 3
2020-04-12 21:06:04 PDT
(In reply to Sam Weinig from
comment #2
)
> Comment on
attachment 396252
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=396252&action=review
> > > Source/WebCore/layout/tableformatting/TableFormattingContext.cpp:281 > > Vector<FormattingContext::IntrinsicWidthConstraints> columnIntrinsicWidths; > > + columnIntrinsicWidths.fill({ }, columnList.size()); > > I think this can be slightly more efficient if you use the Vector > constructor that takes a size + value to fill: > > Vector<FormattingContext::IntrinsicWidthConstraints> > columnIntrinsicWidths(columnList.size(), { }); > > (or, if std::is_pod<FormattingContext::IntrinsicWidthConstraints>::value is > true, you can just pass the size). > > > Source/WebCore/layout/tableformatting/TableFormattingContext.cpp:341 > > Vector<ColumnMinimumWidth> columnMinimumWidths; > > + columnMinimumWidths.fill({ }, columns.size()); > > Same here.
(yes, it now annoys me that the Vector::fill() and the filling Vector constructor take their arguments in opposite order).
zalan
Comment 4
2020-04-12 21:12:24 PDT
(In reply to Sam Weinig from
comment #2
)
> Comment on
attachment 396252
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=396252&action=review
> > > Source/WebCore/layout/tableformatting/TableFormattingContext.cpp:281 > > Vector<FormattingContext::IntrinsicWidthConstraints> columnIntrinsicWidths; > > + columnIntrinsicWidths.fill({ }, columnList.size()); > > I think this can be slightly more efficient if you use the Vector > constructor that takes a size + value to fill: > > Vector<FormattingContext::IntrinsicWidthConstraints> > columnIntrinsicWidths(columnList.size(), { }); > > (or, if std::is_pod<FormattingContext::IntrinsicWidthConstraints>::value is > true, you can just pass the size). > > > Source/WebCore/layout/tableformatting/TableFormattingContext.cpp:341 > > Vector<ColumnMinimumWidth> columnMinimumWidths; > > + columnMinimumWidths.fill({ }, columns.size()); > > Same here.
Thanks Sam. Yeah, I should have looked at the c'tors (funny side note; whenever I try to use some WTF APIs, someone tells me there's a more efficient way to do it.:)
zalan
Comment 5
2020-04-13 08:10:36 PDT
Created
attachment 396277
[details]
Patch
EWS
Comment 6
2020-04-13 08:11:43 PDT
ChangeLog entry in LayoutTests/ChangeLog contains OOPS!.
zalan
Comment 7
2020-04-13 08:12:40 PDT
Created
attachment 396279
[details]
Patch
EWS
Comment 8
2020-04-13 08:58:31 PDT
Committed
r260009
: <
https://trac.webkit.org/changeset/260009
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 396279
[details]
.
Radar WebKit Bug Importer
Comment 9
2020-04-13 08:59:13 PDT
<
rdar://problem/61718322
>
Sam Weinig
Comment 10
2020-04-13 09:32:51 PDT
(In reply to zalan from
comment #4
)
> (In reply to Sam Weinig from
comment #2
) > > Comment on
attachment 396252
[details]
> > Patch > > > > View in context: > >
https://bugs.webkit.org/attachment.cgi?id=396252&action=review
> > > > > Source/WebCore/layout/tableformatting/TableFormattingContext.cpp:281 > > > Vector<FormattingContext::IntrinsicWidthConstraints> columnIntrinsicWidths; > > > + columnIntrinsicWidths.fill({ }, columnList.size()); > > > > I think this can be slightly more efficient if you use the Vector > > constructor that takes a size + value to fill: > > > > Vector<FormattingContext::IntrinsicWidthConstraints> > > columnIntrinsicWidths(columnList.size(), { }); > > > > (or, if std::is_pod<FormattingContext::IntrinsicWidthConstraints>::value is > > true, you can just pass the size). > > > > > Source/WebCore/layout/tableformatting/TableFormattingContext.cpp:341 > > > Vector<ColumnMinimumWidth> columnMinimumWidths; > > > + columnMinimumWidths.fill({ }, columns.size()); > > > > Same here. > Thanks Sam. Yeah, I should have looked at the c'tors (funny side note; > whenever I try to use some WTF APIs, someone tells me there's a more > efficient way to do it.:)
(Alas, we have been adding little optimizations for years here. Admittedly, most are around avoid extra size checks when we know things are uninitialized and who knows if compilers right now might be able to do that for us, but alas, here we are).
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