Unreviewed, use std::vector instead of variable length array
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Oct 2017 01:15:36 +0000 (01:15 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Oct 2017 01:15:36 +0000 (01:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=177856

This is OK because originally this code uses dispatch queue, which
should have allocation inside it too.

* MallocBench/MallocBench/message.cpp:
(benchmark_message_many):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222948 268f45cc-cd09-0410-ab3c-d52691b4dbfc

PerformanceTests/ChangeLog
PerformanceTests/MallocBench/MallocBench/message.cpp

index d00b0a8..29e9e20 100644 (file)
@@ -1,5 +1,16 @@
 2017-10-05  Yusuke Suzuki  <utatane.tea@gmail.com>
 
+        Unreviewed, use std::vector instead of variable length array
+        https://bugs.webkit.org/show_bug.cgi?id=177856
+
+        This is OK because originally this code uses dispatch queue, which
+        should have allocation inside it too.
+
+        * MallocBench/MallocBench/message.cpp:
+        (benchmark_message_many):
+
+2017-10-05  Yusuke Suzuki  <utatane.tea@gmail.com>
+
         [Linux] Port MallocBench
         https://bugs.webkit.org/show_bug.cgi?id=177856
 
index 7633f9f..d6a53e1 100644 (file)
@@ -32,6 +32,7 @@
 #include <stdlib.h>
 #include <strings.h>
 #include <thread>
+#include <vector>
 
 #include "mbmalloc.h"
 
@@ -209,9 +210,10 @@ void benchmark_message_many(CommandLine& commandLine)
     const size_t quantum = 16;
 
     const size_t queueCount = cpuCount() - 1;
-    std::unique_ptr<WorkQueue> queues[queueCount];
+    std::vector<std::unique_ptr<WorkQueue>> queues;
+    queues.reserve(queueCount);
     for (size_t i = 0; i < queueCount; ++i)
-        queues[i] = std::make_unique<WorkQueue>();
+        queues.emplace_back(std::make_unique<WorkQueue>());
 
     for (size_t i = 0; i < times; i += quantum) {
         for (size_t j = 0; j < quantum; ++j) {