As for your componentization proposal, it's still looks unclear to me. I'll send comments separately.
Now that the core-modules componentization is done, we're planning to start the Blink componentization v1 [1]. The componentization is going to move a bunch of fundamental classes in platform/ to wtf/ (e.g., Timer, LifecycleObserver, Oilpan, SharedBuffer etc). In preparation for the migration, we're planning to replace the "WTF" namespace with the "blink" namespace.
What about WTF macros like WTF_ARRAY_LENGTH and WTF classes like WTFString. Will those retain the WTF prefix for now or will they also be renamed as part of this effort?
I might miss the FAQ about what WTF stands for a bit :)
What's the advantage of removing this namespace?
Note that Timer and LifecycleObserver do not belong in wtf. wtf is like base,
it's a reusable standard library that hopefully we'll be able to merge into base and then start using the same classes in content after the repo merge.
What's the advantage of removing this namespace?The advantages of the Blink componentization are explained in this document (https://docs.google.com/document/d/1vtpoNdywErT2wtbE6a64scePBnZycuRhkbuuaIpiu2I/edit). Removing the WTF namespace is the first step for the componentization.Note that Timer and LifecycleObserver do not belong in wtf. wtf is like base,One of the main goals of the componentization is to fix the broken dependency structure, which has resulted in a lot of unnecessary abstraction classes to hack the dependency. To fix the broken dependency, we're planning to remove platform/ and rearchitect the dependency to modules/ => core/ => wtf/ (very simple!). This means that things in platform/ that are depended on by core/ need to be moved to wtf/. This is why I want to move Timer, LifecycleObserver, Oilpan etc to wtf/. The "Oilpan and Vector" section of the above document would be helpful to understand the problem caused by mixing "things depended on by core/" in wtf/ and platform/ (Note: Oilpan is just one example, and a similar problem is taking place in other places as well).If we really want to keep the WTF namespace, we can put Timer, LifecycleObserver etc in the WTF namespace when moving them into wtf/. However, IMHO it seems simpler to just drop the WTF namespace.What's your concern about dropping the WTF namespace?
it's a reusable standard library that hopefully we'll be able to merge into base and then start using the same classes in content after the repo merge.That is our plan (i.e., make wtf/ depend on Chromium's base/ and share more code with Chromium), but I think we'll need to keep lots of code in wtf/ even after the repo merge. Since performance is the most important thing in Blink, we want to keep AtomicString, PassRefPtr, Vector with inline capacity etc in wtf/. Also Oilpan needs to hook allocation points of collections, we'll need to keep Vectors, HashMaps etc in wtf/ as well.
On Tue, May 26, 2015 at 4:45 PM, Kentaro Hara <har...@chromium.org> wrote:What's the advantage of removing this namespace?The advantages of the Blink componentization are explained in this document (https://docs.google.com/document/d/1vtpoNdywErT2wtbE6a64scePBnZycuRhkbuuaIpiu2I/edit). Removing the WTF namespace is the first step for the componentization.Note that Timer and LifecycleObserver do not belong in wtf. wtf is like base,One of the main goals of the componentization is to fix the broken dependency structure, which has resulted in a lot of unnecessary abstraction classes to hack the dependency. To fix the broken dependency, we're planning to remove platform/ and rearchitect the dependency to modules/ => core/ => wtf/ (very simple!). This means that things in platform/ that are depended on by core/ need to be moved to wtf/. This is why I want to move Timer, LifecycleObserver, Oilpan etc to wtf/. The "Oilpan and Vector" section of the above document would be helpful to understand the problem caused by mixing "things depended on by core/" in wtf/ and platform/ (Note: Oilpan is just one example, and a similar problem is taking place in other places as well).If we really want to keep the WTF namespace, we can put Timer, LifecycleObserver etc in the WTF namespace when moving them into wtf/. However, IMHO it seems simpler to just drop the WTF namespace.What's your concern about dropping the WTF namespace?That code shouldn't be in the same namespace as core. You're proposing the equivalent of merging the cc and content namespaces.wtf is our standard library, it's not part of core.
it's a reusable standard library that hopefully we'll be able to merge into base and then start using the same classes in content after the repo merge.That is our plan (i.e., make wtf/ depend on Chromium's base/ and share more code with Chromium), but I think we'll need to keep lots of code in wtf/ even after the repo merge. Since performance is the most important thing in Blink, we want to keep AtomicString, PassRefPtr, Vector with inline capacity etc in wtf/. Also Oilpan needs to hook allocation points of collections, we'll need to keep Vectors, HashMaps etc in wtf/ as well.I think we want to be able to use Vectors with inline capacity in content, scheduler, cc, and other things too.- E
On Wed, May 27, 2015 at 8:51 AM, Elliott Sprehn <esp...@chromium.org> wrote:On Tue, May 26, 2015 at 4:45 PM, Kentaro Hara <har...@chromium.org> wrote:What's the advantage of removing this namespace?The advantages of the Blink componentization are explained in this document (https://docs.google.com/document/d/1vtpoNdywErT2wtbE6a64scePBnZycuRhkbuuaIpiu2I/edit). Removing the WTF namespace is the first step for the componentization.Note that Timer and LifecycleObserver do not belong in wtf. wtf is like base,One of the main goals of the componentization is to fix the broken dependency structure, which has resulted in a lot of unnecessary abstraction classes to hack the dependency. To fix the broken dependency, we're planning to remove platform/ and rearchitect the dependency to modules/ => core/ => wtf/ (very simple!). This means that things in platform/ that are depended on by core/ need to be moved to wtf/. This is why I want to move Timer, LifecycleObserver, Oilpan etc to wtf/. The "Oilpan and Vector" section of the above document would be helpful to understand the problem caused by mixing "things depended on by core/" in wtf/ and platform/ (Note: Oilpan is just one example, and a similar problem is taking place in other places as well).If we really want to keep the WTF namespace, we can put Timer, LifecycleObserver etc in the WTF namespace when moving them into wtf/. However, IMHO it seems simpler to just drop the WTF namespace.What's your concern about dropping the WTF namespace?That code shouldn't be in the same namespace as core. You're proposing the equivalent of merging the cc and content namespaces.wtf is our standard library, it's not part of core.I don't fully understand your point, but are you just opposing to dropping the WTF namespace? Or are you opposing to move platform/ things depended on by core/ to wtf/?
I understand that you want to keep standard things in the WTF namespace for some philosophical reasons (but the meaning of "standard" is already obscure -- we've already put a bunch of "standard" things in platform/ to hack the dependency), but I think that the advantages of fixing the broken dependency structure and simplifying the code base would be more practical and important.
On Tue, May 26, 2015 at 5:05 PM, Kentaro Hara <har...@chromium.org> wrote:On Wed, May 27, 2015 at 8:51 AM, Elliott Sprehn <esp...@chromium.org> wrote:On Tue, May 26, 2015 at 4:45 PM, Kentaro Hara <har...@chromium.org> wrote:What's the advantage of removing this namespace?The advantages of the Blink componentization are explained in this document (https://docs.google.com/document/d/1vtpoNdywErT2wtbE6a64scePBnZycuRhkbuuaIpiu2I/edit). Removing the WTF namespace is the first step for the componentization.Note that Timer and LifecycleObserver do not belong in wtf. wtf is like base,One of the main goals of the componentization is to fix the broken dependency structure, which has resulted in a lot of unnecessary abstraction classes to hack the dependency. To fix the broken dependency, we're planning to remove platform/ and rearchitect the dependency to modules/ => core/ => wtf/ (very simple!). This means that things in platform/ that are depended on by core/ need to be moved to wtf/. This is why I want to move Timer, LifecycleObserver, Oilpan etc to wtf/. The "Oilpan and Vector" section of the above document would be helpful to understand the problem caused by mixing "things depended on by core/" in wtf/ and platform/ (Note: Oilpan is just one example, and a similar problem is taking place in other places as well).If we really want to keep the WTF namespace, we can put Timer, LifecycleObserver etc in the WTF namespace when moving them into wtf/. However, IMHO it seems simpler to just drop the WTF namespace.What's your concern about dropping the WTF namespace?That code shouldn't be in the same namespace as core. You're proposing the equivalent of merging the cc and content namespaces.wtf is our standard library, it's not part of core.I don't fully understand your point, but are you just opposing to dropping the WTF namespace? Or are you opposing to move platform/ things depended on by core/ to wtf/?Both. Platform is not WTF, and WTF is not core.I understand that you want to keep standard things in the WTF namespace for some philosophical reasons (but the meaning of "standard" is already obscure -- we've already put a bunch of "standard" things in platform/ to hack the dependency), but I think that the advantages of fixing the broken dependency structure and simplifying the code base would be more practical and important.WTF is the standard library, cc/ should be able to use WTF too.
it's a reusable standard library that hopefully we'll be able to merge into base and then start using the same classes in content after the repo merge.That is our plan (i.e., make wtf/ depend on Chromium's base/ and share more code with Chromium), but I think we'll need to keep lots of code in wtf/ even after the repo merge. Since performance is the most important thing in Blink, we want to keep AtomicString, PassRefPtr, Vector with inline capacity etc in wtf/. Also Oilpan needs to hook allocation points of collections, we'll need to keep Vectors, HashMaps etc in wtf/ as well.I think we want to be able to use Vectors with inline capacity in content, scheduler, cc, and other things too.- E--Kentaro Hara, Tokyo, Japan
On Tue, May 26, 2015 at 5:05 PM, Kentaro Hara <har...@chromium.org> wrote:On Wed, May 27, 2015 at 8:51 AM, Elliott Sprehn <esp...@chromium.org> wrote:On Tue, May 26, 2015 at 4:45 PM, Kentaro Hara <har...@chromium.org> wrote:What's the advantage of removing this namespace?The advantages of the Blink componentization are explained in this document (https://docs.google.com/document/d/1vtpoNdywErT2wtbE6a64scePBnZycuRhkbuuaIpiu2I/edit). Removing the WTF namespace is the first step for the componentization.Note that Timer and LifecycleObserver do not belong in wtf. wtf is like base,One of the main goals of the componentization is to fix the broken dependency structure, which has resulted in a lot of unnecessary abstraction classes to hack the dependency. To fix the broken dependency, we're planning to remove platform/ and rearchitect the dependency to modules/ => core/ => wtf/ (very simple!). This means that things in platform/ that are depended on by core/ need to be moved to wtf/. This is why I want to move Timer, LifecycleObserver, Oilpan etc to wtf/. The "Oilpan and Vector" section of the above document would be helpful to understand the problem caused by mixing "things depended on by core/" in wtf/ and platform/ (Note: Oilpan is just one example, and a similar problem is taking place in other places as well).If we really want to keep the WTF namespace, we can put Timer, LifecycleObserver etc in the WTF namespace when moving them into wtf/.
However, IMHO it seems simpler to just drop the WTF namespace.What's your concern about dropping the WTF namespace?That code shouldn't be in the same namespace as core. You're proposing the equivalent of merging the cc and content namespaces.wtf is our standard library, it's not part of core.I don't fully understand your point, but are you just opposing to dropping the WTF namespace? Or are you opposing to move platform/ things depended on by core/ to wtf/?Both. Platform is not WTF, and WTF is not core.I understand that you want to keep standard things in the WTF namespace for some philosophical reasons (but the meaning of "standard" is already obscure -- we've already put a bunch of "standard" things in platform/ to hack the dependency), but I think that the advantages of fixing the broken dependency structure and simplifying the code base would be more practical and important.WTF is the standard library, cc/ should be able to use WTF too.
it's a reusable standard library that hopefully we'll be able to merge into base and then start using the same classes in content after the repo merge.That is our plan (i.e., make wtf/ depend on Chromium's base/ and share more code with Chromium), but I think we'll need to keep lots of code in wtf/ even after the repo merge. Since performance is the most important thing in Blink, we want to keep AtomicString, PassRefPtr, Vector with inline capacity etc in wtf/. Also Oilpan needs to hook allocation points of collections, we'll need to keep Vectors, HashMaps etc in wtf/ as well.I think we want to be able to use Vectors with inline capacity in content, scheduler, cc, and other things too.
Oilpan depends on WebThread, which now depends on WebScheduler, so the dependency graph might become a bit tricky if we want to move Oilpan into wtf/.
Just to keep the discussion sane, lets move discussion of things to reuse from WTF to this thread and let the original thread focus on the componentization discussion.On Tue, May 26, 2015 at 7:47 PM Kinuko Yasuda <kin...@chromium.org> wrote:On Wed, May 27, 2015 at 9:09 AM, Elliott Sprehn <esp...@chromium.org> wrote:On Tue, May 26, 2015 at 5:05 PM, Kentaro Hara <har...@chromium.org> wrote:I understand that you want to keep standard things in the WTF namespace for some philosophical reasons (but the meaning of "standard" is already obscure -- we've already put a bunch of "standard" things in platform/ to hack the dependency), but I think that the advantages of fixing the broken dependency structure and simplifying the code base would be more practical and important.WTF is the standard library, cc/ should be able to use WTF too.This seems to be where things diverge. If we want to use WTF outside Blink we probably don't want to make WTF dependable on all other blink code.I was thinking that we could move some of very basic WTF classes that are useful outside Blink into src/base one by one, partly because I've been worrying that just exposing all WTF classes would introduce a lot of confusion (as base doesn't understand WTF types and WTF doesn't understand base types).Specifically talking about WTF::Vector, if we really want to use WTF::Vector as a standard utility (but without oilpan) it looks viable options (other than merging everything) would be:
- Keep WTF as is, HeapVector could continue to utilize WTF::Vector by specializing its allocator or could be implemented on its own outside WTF.
- WTF::Vector is now blink::Vector, implement yet another similar lightweight vector class in src/base so that all chromium code can use it.
it's a reusable standard library that hopefully we'll be able to merge into base and then start using the same classes in content after the repo merge.That is our plan (i.e., make wtf/ depend on Chromium's base/ and share more code with Chromium), but I think we'll need to keep lots of code in wtf/ even after the repo merge. Since performance is the most important thing in Blink, we want to keep AtomicString, PassRefPtr, Vector with inline capacity etc in wtf/. Also Oilpan needs to hook allocation points of collections, we'll need to keep Vectors, HashMaps etc in wtf/ as well.I think we want to be able to use Vectors with inline capacity in content, scheduler, cc, and other things too.What other containers / utilities do are you thinking you want to use outside Blink?
I wonder how much of WTF will stay after blink has been merged into the chromium repo? I doubt it will all go but if it ends up being a lot smaller, the arguments for keeping the WTF namespace seem weaker to me.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
Keep WTF as is, HeapVector could continue to utilize WTF::Vector by specializing its allocator or could be implemented on its own outside WTF.
I wonder how much of WTF will stay after blink has been merged into the chromium repo? I doubt it will all go but if it ends up being a lot smaller, the arguments for keeping the WTF namespace seem weaker to me.
On Wed, 27 May 2015 10:05:32 +0200, 'Alex Clarke' via blink-dev <blin...@chromium.org> wrote:I wonder how much of WTF will stay after blink has been merged into the chromium repo? I doubt it will all go but if it ends up being a lot smaller, the arguments for keeping the WTF namespace seem weaker to me.
The big bulk is string/text management and collection classes. The collection classes might be replacable by STL collection classes, partly or wholly but considering that so much of a web engine is string management and depending on very specific characteristics of the string class, it seems unlikely that std::string (from more or less random STL libraries) will be able to fully replace the blink String class.
On Wed, May 27, 2015 at 6:30 PM, Daniel Bratell <bra...@opera.com> wrote:On Wed, 27 May 2015 10:05:32 +0200, 'Alex Clarke' via blink-dev <blin...@chromium.org> wrote:I wonder how much of WTF will stay after blink has been merged into the chromium repo? I doubt it will all go but if it ends up being a lot smaller, the arguments for keeping the WTF namespace seem weaker to me.
My take here is relatively optimistic: if it gets smaller enough we could reconsider :)
Here is a slightly revised version of the proposal :)Given the complexity of Blink, it's hard to describe the proposal concisely, but I hope the figure attached to this email will help you understand the essence of the proposal. The figure illustrates what files are going to be moved to what directories for several representative files.- The proposed dependency is modules/ => core/ => wtf/ => base/. Simple!- In the original proposal, I was planning to move "all files in platform/ that don't depend on core/" to wtf/. However, as Ellioot pointed out, it might be too much. In the revised proposal, I'm planning to move "only files in platform/ that really need to be moved to wtf/" to wtf/. For example, Oilpan will be moved from platform/ to wtf/, but Timer and LifecycleObserver will be moved from platform/ to core/. (Note: In terms of dependency, it is possible to put Timer and LifecycleObserver in wtf/ because they don't depend on core/. In that sense, it is a bit ambiguous what should be in wtf/ and what should be in core/.)- The revised proposal will reduce the number of files we need to move to wtf/. Thus it is not mandatory to remove the WTF namespace. We can keep the WTF namespace as is.- As we're discussing in another thread, things in wtf/ that are useful for Chromium will be moved to base/.- In the original proposal, I was planning to put public APIs (i.e., header files) in public/delegate/ and public/web/. However, there would be little benefit in splitting the APIs in two directories, so I'm now planning to put all public APIs in public/. Their implementations will be put in either of core/web/, core/modules/ or content/.
Does this make more sense? Thanks!--On Wed, May 27, 2015 at 8:27 PM, Kinuko Yasuda <kin...@chromium.org> wrote:On Wed, May 27, 2015 at 6:30 PM, Daniel Bratell <bra...@opera.com> wrote:On Wed, 27 May 2015 10:05:32 +0200, 'Alex Clarke' via blink-dev <blin...@chromium.org> wrote:I wonder how much of WTF will stay after blink has been merged into the chromium repo? I doubt it will all go but if it ends up being a lot smaller, the arguments for keeping the WTF namespace seem weaker to me.
My take here is relatively optimistic: if it gets smaller enough we could reconsider :)The big bulk is string/text management and collection classes. The collection classes might be replacable by STL collection classes, partly or wholly but considering that so much of a web engine is string management and depending on very specific characteristics of the string class, it seems unlikely that std::string (from more or less random STL libraries) will be able to fully replace the blink String class.WTF collection classes use partition alloc and are highly tuned in terms of memory usage and performance, I think that probably holds a strong reason to keep them around separately from STL collection classes.Many of the macros in various WTF header files and other random utility functions should probably be moved/merged into base.But this is a bit academic. Maybe WTF will become tiny enough that having its own namespace will seem silly. Maybe not. When it feels silly it would be a good time to change it.And in case it is not clear, I also think there is value in having the utility library in its own namespace. Not critical but a useful feature. The value is somewhat diminished today by all the "using WTF::Foo" statements in the headers though./DanielKentaro Hara, Tokyo, Japan
two things that aren't clear to me: why does wtf need to depend on base? couldn't stuff above wtf (continue to) depends on both wtf and base?
And: why are we moving platform concepts such as networking into core? in chrome, net/ is also outside of e.g. content/?
> And: why are we moving platform concepts such as networking into core? in chrome, net/ is also outside of e.g. content/?
That is a key question. Conceptually we can consider a dependency like web/ => modules/ => core/ => platform/ => wtf/ (e.g., put the network layer in platform/), and we actually have the dependency in the current architecture. However, what we've learned in the Blink code base is that the dependency has resulted in a lot of abstraction classes & hacks to overcome disallowed dependencies (e.g., WebIDB, ServiceWorker, Oilpan etc). Conceptually web/ => modules/ => core/ => platform/ => wtf/ looks cool, but in practice it is hard to implement classes according to the dependency model. Thus I think that overall it is better to simplify the dependency to modules/ => core/ => wtf/ and remove those abstractions & hacks. We will lose some layering concepts, but I believe that the advantages of the simplification would be a clear win. (Note: We will lose some layering concepts in terms of link units, but we still can/should keep a good layering inside the link unit.)
two things that aren't clear to me: why does wtf need to depend on base? couldn't stuff above wtf (continue to) depends on both wtf and base?If we move Vector to base/ while letting wtf/ use Vector, we need to make wtf/ depend on base/.
For things like vector *modern* std::vector is probably equivalent to WTF::Vector in pretty much all cases.
- E
(Moving WTF reuse / merging-to-base discussion from the original thread)On Wed, May 27, 2015 at 8:27 PM, Kinuko Yasuda <kin...@chromium.org> wrote:On Wed, May 27, 2015 at 6:30 PM, Daniel Bratell <bra...@opera.com> wrote:On Wed, 27 May 2015 10:05:32 +0200, 'Alex Clarke' via blink-dev <blin...@chromium.org> wrote:I wonder how much of WTF will stay after blink has been merged into the chromium repo? I doubt it will all go but if it ends up being a lot smaller, the arguments for keeping the WTF namespace seem weaker to me.
My take here is relatively optimistic: if it gets smaller enough we could reconsider :)By the way I've been trying to create a list of what WTF classes/utilities can be removed, or merged / subsumed into base/. It's incomplete (and I could be wrong on many) but since we started to discuss this let me share this now:https://docs.google.com/spreadsheets/d/1VO9CwSTuQPIaPYCommnjZKBx9yIrU8Q1jJuBpLPTfSM/edit?usp=sharingMany of utilities that are highly tuned in terms of performance/memory usage are currently marked 'cannot be merged into base/ now' in this spreadsheet but it's purely because I thought it'd need some work / consideration before doing so.
On Wed, May 27, 2015 at 4:37 AM Kinuko Yasuda <kin...@chromium.org> wrote:(Moving WTF reuse / merging-to-base discussion from the original thread)On Wed, May 27, 2015 at 8:27 PM, Kinuko Yasuda <kin...@chromium.org> wrote:On Wed, May 27, 2015 at 6:30 PM, Daniel Bratell <bra...@opera.com> wrote:On Wed, 27 May 2015 10:05:32 +0200, 'Alex Clarke' via blink-dev <blin...@chromium.org> wrote:I wonder how much of WTF will stay after blink has been merged into the chromium repo? I doubt it will all go but if it ends up being a lot smaller, the arguments for keeping the WTF namespace seem weaker to me.
My take here is relatively optimistic: if it gets smaller enough we could reconsider :)By the way I've been trying to create a list of what WTF classes/utilities can be removed, or merged / subsumed into base/. It's incomplete (and I could be wrong on many) but since we started to discuss this let me share this now:https://docs.google.com/spreadsheets/d/1VO9CwSTuQPIaPYCommnjZKBx9yIrU8Q1jJuBpLPTfSM/edit?usp=sharingMany of utilities that are highly tuned in terms of performance/memory usage are currently marked 'cannot be merged into base/ now' in this spreadsheet but it's purely because I thought it'd need some work / consideration before doing so.Do you want help sorting this? If so, can you make it editable?
std::vector doesn't let you set inline capacity to avoid malloc in common cases. That allows blink to avoid doing malloc in a number of cases. It also means better memory locality since the data is right there on the stack.
(Moving discussion from the original thread, cc-ing chromium-dev@)Context: there's a discussion about removing WTF namespace in blink-dev (the proposal was dropped fyi), and there were some voices that we may want to use some of WTF classes out of Blink. One idea is to move some of move or merge some of very basic WTF classes that could be useful outside Blink into src/base one by one, only when we have concrete proof / data that shows using it across chromium has clear benefit.A specific request made by esprehn@ (and some other folks) was cc/ and some other out-of-blink components want to use WTF::Vector (which is blink's std::vector), because those WTF container classes are (supposed to be) highly tuned in terms of performance/memory usage. Some discussion about why WTF::Vector could be better than std::vector can be found in the original thread, but esprehn@ summarizes the potential benefit like below:std::vector doesn't let you set inline capacity to avoid malloc in common cases. That allows blink to avoid doing malloc in a number of cases. It also means better memory locality since the data is right there on the stack.I think we basically agree that we'll need to look into this case-by-case basis, and I started a spreadsheet to list up all WTF classes and see if we can/want to:1) remove it by replacing its usage with base/'s similar utility,2) move it to base/ (or somewhere outside blink/) so that all chromium can use them, or3) keep it within blink/.The spreadsheet (now editable by anyone @chromium):
--- James
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
I'm curious - once we ship Oilpan, will there still be a lot of
refcounted objects left in blink?
I'm looking forward to data on a case-by-case basis to replace STL types with WTF types. If they can make chromium faster/smaller that seems like something we can get behind. I'm a little more skeptical than are people coming from the blink side of things, I think, but that's what data is for.
On Wed, 27 May 2015 21:14:17 +0200, Dana Jansens <dan...@chromium.org> wrote:I'm looking forward to data on a case-by-case basis to replace STL types with WTF types. If they can make chromium faster/smaller that seems like something we can get behind. I'm a little more skeptical than are people coming from the blink side of things, I think, but that's what data is for.Me too. And there are at least three factors: Performance (in various use cases), memory usage, and amount of generated machine code ("bloat").
On Thu, May 28, 2015 at 2:09 AM, Daniel Bratell <bra...@opera.com> wrote:On Wed, 27 May 2015 21:14:17 +0200, Dana Jansens <dan...@chromium.org> wrote:I'm looking forward to data on a case-by-case basis to replace STL types with WTF types. If they can make chromium faster/smaller that seems like something we can get behind. I'm a little more skeptical than are people coming from the blink side of things, I think, but that's what data is for.Me too. And there are at least three factors: Performance (in various use cases), memory usage, and amount of generated machine code ("bloat").I'd add one more, modern language support & stl compatibility. E.g. movable types, algorithms etc.
On Thu, May 28, 2015 at 1:30 PM, Dana Jansens <dan...@chromium.org> wrote:
On Wed, May 27, 2015 at 6:11 PM, Kentaro Hara <har...@chromium.org> wrote:
...
Is it possible to use inline capacity and satisfy the same guarantees about iterator validity across mutations of the vector as with std::vector?
I think this is not a problem.base has StackVector which does this and I don't think there are problems. If Kentaro is correct and that the material difference between std::vector and WTF::Vector is only this inline buffer, one path forward for this container type is to unify on one "vector with a static buffer" object and use it everywhere, dropping the more subtle optimizations WTF::Vector does for optimizing initialization and copies.
My anecdotal experience (from long ago) with WTF's hash table is that it is difficult to use because of the way it handled deleted and empty buckets. It was optimized to avoid heap allocations, which makes it faster, but I wasted an afternoon trying to figure out why my code was crashing. It's good to trade-off speed for usability in some performance critical cases, but for general browser usage I worry that this is not the best approach.
WTF's strings are unambiguously faster for some workloads, but if you use them wrong (pass between threads like the browser process does a lot but Blink does a little) you end up with subtle crashes. This is another example of Blink trading off generality and ease-of-use for speed. If it makes for a crashier product and less productive team, then it's a net negative even if things are some percent faster or smaller.
Especially around string handling, I think Blink's workloads are very different than the rest of the browser. The main question I have is whether there are other significant subsystems where the same tradeoffs that Blink made are also appropriate. And if there are, how can we allow those subsystems to make those tradeoffs without making a soup of similar but incompatible types floating around (which will lead to a slower product overall).
Also I have a couple of plans to more optimize WTF::Vector for Blink's common workloads, and I believe these efforts are important. So I want to keep those containers in wtf/ and optimize them for Blink.(Let me reply to Brett's comment in the other thread, since my reply is more related to this topic.)Brett:My anecdotal experience (from long ago) with WTF's hash table is that it is difficult to use because of the way it handled deleted and empty buckets. It was optimized to avoid heap allocations, which makes it faster, but I wasted an afternoon trying to figure out why my code was crashing. It's good to trade-off speed for usability in some performance critical cases, but for general browser usage I worry that this is not the best approach.WTF's strings are unambiguously faster for some workloads, but if you use them wrong (pass between threads like the browser process does a lot but Blink does a little) you end up with subtle crashes. This is another example of Blink trading off generality and ease-of-use for speed. If it makes for a crashier product and less productive team, then it's a net negative even if things are some percent faster or smaller.I agree with your point, and that is why I'm not really willing to move a lot of things from wtf/ to base/. The assumption in Blink (speed, speed, speed!) is somewhat special and the assumption doesn't necessarily hold in other components in Chromium.For example, I don't think Chromium wants to use PassRefPtr. PassRefPtr is an optimized version of std::ref_ptr to skip increments/decrements when passing the pointer to other functions etc. This optimization is actually important for Blink's performance (I confirmed the performance impact a while back), but most components in Chromium wouldn't buy that advantage. The same discussion applies for Strings, Vectors, HashTables etc.
On Thu, May 28, 2015 at 4:53 PM Kentaro Hara <har...@chromium.org> wrote:Also I have a couple of plans to more optimize WTF::Vector for Blink's common workloads, and I believe these efforts are important. So I want to keep those containers in wtf/ and optimize them for Blink.(Let me reply to Brett's comment in the other thread, since my reply is more related to this topic.)Brett:My anecdotal experience (from long ago) with WTF's hash table is that it is difficult to use because of the way it handled deleted and empty buckets. It was optimized to avoid heap allocations, which makes it faster, but I wasted an afternoon trying to figure out why my code was crashing. It's good to trade-off speed for usability in some performance critical cases, but for general browser usage I worry that this is not the best approach.WTF's strings are unambiguously faster for some workloads, but if you use them wrong (pass between threads like the browser process does a lot but Blink does a little) you end up with subtle crashes. This is another example of Blink trading off generality and ease-of-use for speed. If it makes for a crashier product and less productive team, then it's a net negative even if things are some percent faster or smaller.I agree with your point, and that is why I'm not really willing to move a lot of things from wtf/ to base/. The assumption in Blink (speed, speed, speed!) is somewhat special and the assumption doesn't necessarily hold in other components in Chromium.For example, I don't think Chromium wants to use PassRefPtr. PassRefPtr is an optimized version of std::ref_ptr to skip increments/decrements when passing the pointer to other functions etc. This optimization is actually important for Blink's performance (I confirmed the performance impact a while back), but most components in Chromium wouldn't buy that advantage. The same discussion applies for Strings, Vectors, HashTables etc.FWIW, std::ref_ptr (and the scoped_refptr in //base) do support this using move semantics.
That being said, I guess Oilpan also removes a lot of the refcounted objects in Blink so maybe it really doesn't matter.
On Thu, May 28, 2015 at 2:09 AM, Daniel Bratell <bra...@opera.com> wrote:On Wed, 27 May 2015 21:14:17 +0200, Dana Jansens <dan...@chromium.org> wrote:I'm looking forward to data on a case-by-case basis to replace STL types with WTF types. If they can make chromium faster/smaller that seems like something we can get behind. I'm a little more skeptical than are people coming from the blink side of things, I think, but that's what data is for.Me too. And there are at least three factors: Performance (in various use cases), memory usage, and amount of generated machine code ("bloat").I'd add one more, modern language support & stl compatibility. E.g. movable types, algorithms etc.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.