Commit Graph

11 Commits

Author SHA1 Message Date
Eike Ziller
990f52957d Fix mapReduce with QVector input
The iterator type of QVector is just (const) T *, so we cannot call
::reference on it directly. Access via std::iterator_traits instead.

This is especially interesting in the light of Qt 6 replacing QList with
QVector.

Change-Id: Ib4e84f61302822e51b8984e2a44fea874efce81d
Reviewed-by: hjk <hjk@qt.io>
2019-11-12 13:48:24 +00:00
Eike Ziller
83b8c8fc15 Reduce CPU load of test parsing
Use a thread pool with reduced max thread count.

Task-number: QTCREATORBUG-18185
Change-Id: I18bd3de82365edaf21d8dcf9c89035da1ac74756
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-05-16 10:46:13 +00:00
Eike Ziller
37076e8c33 Reduce thread priority for test parsing
Adding API for that to the parallel map/reduce functions

Change-Id: Ic7987d899c124dcb04c1ca110b09fc97576873fe
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-11-15 15:00:18 +00:00
Orgad Shaneh
98a0c816f7 Tests: Do not use deprecated Qt algorithms
Change-Id: I3ca177b69df3540729a98d8d3b6287df36a47ea0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2016-08-15 07:22:59 +00:00
Eike Ziller
817db22fb9 mapReduce: Add remaining API use cases from QtConcurrent
- simpler mapReduce
- blocking mappedReduced
- map with iterators
- blocking mapped

The special QtConcurrent::map for modifying the container is not needed
(it simply is Utils::map with a map function that takes a reference to a
value, and either non-const iterators or a std::ref container).

The special (blocking)filter((ed)Reduced) is simply done with the
Utils::map(ped)/map(ped)Reduce(d) functions with a map function that
takes a QFutureInterface and only reports values if the value should not
be filtered out. That way it can also be used as a
"filteredMappedReduced".

Change-Id: Id8dcbb7277be4d0e27b9e1691df35535dd481924
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-04-12 12:28:15 +00:00
Eike Ziller
12ef434e40 mapReduce: Allow init and cleanup functions without future interface
Change-Id: I49c5f66877db6f7a3b5d175e9ee333451b25d4de
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-04-12 12:27:59 +00:00
Eike Ziller
4996be216d mapReduce: Option for ordered reduce
Change-Id: Ifdf6535315e2032aa5d9d2b56587e27b5dc4b450
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-04-04 10:51:25 +00:00
Eike Ziller
d1a85604af mapReduce test: Fix compilation with GCC 5
Change-Id: I509c5474ab06e80deb70a2e4c43f648265fa00b8
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-03-04 08:27:38 +00:00
Eike Ziller
770bd08803 mapReduce: Perfect forwarding.
Support move-only types for the container, container's item type, the
state type, and all the involved functions.

Change-Id: I5c46e42cc41e46187f7bb4ee4043f8b3b5d31320
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-03-03 14:10:21 +00:00
Eike Ziller
47c3755600 mapReduce: Support progress information and add (unordered) map
If a container is given to mapReduce, it takes the responsibility to
report progress information for the whole operation. If the map function
reports its own progress, that is taken into account for the overall
progress.

The (so far only unordered) Utils::map operation can be used to replace
MultiTask, by passing a member function of the items in the container as
a map function.

Change-Id: I18ca38a6ad2899d73f590bfe59bf2e6eb2f1a57a
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-02-26 08:36:08 +00:00
Eike Ziller
a3c0f0f66a MapReduce refactoring and improvements
- QThread instead of std::thread for better integration with Qt
- Use thread pool for recycling threads
- Map and reduce functions are handled like any function passed
  to runAsync, so they either report results through the
  QFutureInterface, or through the return value.
- Automatically deduce the reduce result type

Change-Id: I7a31370c21f8c27b378cd87c3d5974b162449ce1
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-02-24 10:17:57 +00:00