| Index: test/cctest/test-list-efficiency.cc
|
| diff --git a/test/cctest/test-platform.cc b/test/cctest/test-list-efficiency.cc
|
| similarity index 61%
|
| copy from test/cctest/test-platform.cc
|
| copy to test/cctest/test-list-efficiency.cc
|
| index 6c20b853c5e7408b1877ee74617c01c3fc32ed5f..6127d85dd5d9d7f5e57ee58a04977571f24c3f05 100644
|
| --- a/test/cctest/test-platform.cc
|
| +++ b/test/cctest/test-list-efficiency.cc
|
| @@ -25,13 +25,48 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -#include <stdlib.h>
|
| +#include <sys/time.h>
|
| +
|
| +#include <algorithm>
|
| +#include <vector>
|
|
|
| #include "cctest.h"
|
| -#include "platform.h"
|
| +#include "list.h"
|
| +
|
| +using namespace v8::internal;
|
| +
|
| +TEST(TestListAndStdVector) {
|
| + CcTest::InitializeVM();
|
| +
|
| + {
|
| + struct timeval tv_start;
|
| + gettimeofday(&tv_start, NULL);
|
| + std::vector<int> foo;
|
| + for (int i = 0; i < 10000; ++i)
|
| + foo.push_back(i % 1000);
|
| + std::sort(foo.begin(), foo.end());
|
| +
|
| + struct timeval tv_stop;
|
| + gettimeofday(&tv_stop, NULL);
|
| + fprintf(stderr,
|
| + "std: %ld microseconds\n",
|
| + 1000000 * (tv_stop.tv_sec - tv_start.tv_sec) + tv_stop.tv_usec -
|
| + tv_start.tv_usec);
|
| + }
|
|
|
| -using namespace ::v8::internal;
|
| + {
|
| + struct timeval tv_start;
|
| + gettimeofday(&tv_start, NULL);
|
| + List<int> foo;
|
| + for (int i = 0; i < 10000; ++i)
|
| + foo.Add(i % 1000);
|
| + foo.SortBetter();
|
|
|
| -TEST(NumberOfCores) {
|
| - CHECK_GT(OS::NumberOfCores(), 0);
|
| + struct timeval tv_stop;
|
| + gettimeofday(&tv_stop, NULL);
|
| + fprintf(stderr,
|
| + "list: %ld microseconds\n",
|
| + 1000000 * (tv_stop.tv_sec - tv_start.tv_sec) + tv_stop.tv_usec -
|
| + tv_start.tv_usec);
|
| + }
|
| }
|
|
|