简体   繁体   English

STL vs Stlport:哪一个更轻量

[英]STL vs Stlport: Which one is more lightweight

I have being using stlport to develop wince based custom OS, but from now on I am thinking about using stl provided by windows. 我一直在使用stlport开发基于wince的自定义操作系统,但是从现在开始,我正在考虑使用Windows提供的stl。 I read that functionally they are not different from each other so currently what matters is my image's size. 我读到它们在功能上并没有什么不同,所以目前重要的是我的图像尺寸。 Unfortunately I cannot give both of them a try like first use stl and make a run time image and then use stlport, then compare both images' sizes, because I have a lot of other problems that I need to solve in order to succesfully build the OS. 不幸的是,我无法像尝试先使用stl并制作运行时映像,然后使用stlport,然后比较两个映像的大小一样尝试一下,因为要成功构建该目录,我还有很多其他问题需要解决操作系统。 Hence I wanted to get an expert idea: 因此,我想得到一个专家的想法:

Which one do you think would be more lightweight? 您认为哪一款更轻巧? I know how stlport is attached, loaded etc but I am not quite sure about STL. 我知道stlport是如何附加,加载等的,但是我不太确定STL。 I looked into STL headers and all I saw were thousands of inline functions. 我查看了STL标头,看到的只是数千个内联函数。 But is that all? 但这就是全部吗? I need to be sure about it. 我需要确定一下。 Does STL link any other libraries inside or does it simply include the headers and use those inline functions? STL是链接内部的任何其他库还是仅包含标头并使用这些内联函数?

Best 最好

Ps: I am using VS2012 and working on wec2013 ps:我正在使用VS2012并在wec2013上工作

Ps2: I know what STL and stlport stands for and how to build an application by using them. Ps2:我知道STL和stlport代表什么,以及如何使用它们构建应用程序。 My actual question is which one would consume less memory, use smaller size on HDD? 我的实际问题是哪个会消耗更少的内存,而在HDD上使用更小的尺寸? (Considering things like stlport is a lib but stl is not etc.) (考虑到诸如stlport之类的东西是lib,而stl不是之类的东西。)

I assume that by STL you mean your compiler's standard library. 我假设STL是指编译器的标准库。 This is a common misunderstanding, as STL was the original name of a library that was proposed and accepted into the language, but it has evolved from that. 这是一个普遍的误解,因为STL是该语言的最初提议名称,并已被该语言接受,但它是从此演变而来的。 Taking this into account, the question becomes: 考虑到这一点,问题就变成了:

Should I use the standard library provided with my compiler or use stlport [or other alternatives]? 我应该使用编译器随附的标准库还是使用stlport [或其他替代方法]?

The answer is that it will depend on your use case, but the good thing is that as long as you use the library as defined in the standard (ie without extensions) then you should be able to easily switch from building with one or the other, and that means that you can test this yourself. 答案是,这将取决于您的用例,但是好处是,只要您使用标准中定义的库(即没有扩展名),那么您就应该能够轻松地从一个或另一个构建中切换。 ,这意味着您可以自己对此进行测试。 You can also test building with different compiler flags. 您还可以使用不同的编译器标志测试构建。 This is specially important in VS, as by default the library uses checked iterators, that are good for debugging but at the cost of extra memory and processing. 这在VS中尤为重要,因为默认情况下,该库使用已检查的迭代器,该迭代器可用于调试,但以额外的内存和处理为代价。

STLPort is designed to be used on platforms that does not provide STL for some reasons (for example, embedded platforms without C++ exceptions support), or native STL support is outdated. STLPort旨在用于由于某些原因(例如,不支持C ++异常支持的嵌入式平台)或本地STL支持已过时而未提供STL的平台上。

So, usually you do not need to replace native STL. 因此,通常不需要替换本机STL。 There should be strong reasons to use STLPort in your project. 在项目中使用STLPort应该有充分的理由。 In my experience, I used it for some embedded DSP platforms (no native STL), and for a UEFI platform (not really embedded, but no native STL as well, also runtime does not support C++ exceptions). 以我的经验,我将其用于某些嵌入式DSP平台(没有本机STL)和UEFI平台(不是真正的嵌入式,但也没有本机STL,而且运行时不支持C ++异常)。

STLPort is highly customizable (you can disable exceptions, streams, etc), and can be used on almost any platform with basic C++ support. STLPort是高度可定制的(您可以禁用异常,流等),并且可以在几乎所有具有基本C ++支持的平台上使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM