To count the number of features I use the StatisticsCalulator. I don't want to use an attribute to analyse, I only want to know how many features have past the flow to continue if it is below a certain amount.
Bij (optionally) adding a count-attribute to the featuerholder it is more efficient to achieve this. The attribute is added to all the features.
Just out of curiosity, I did a mini benchmark with some data with a lot of attributes:
FeatureCounter custom transformer = 41.7 s
StatisticsCalculator(Analyse 1 unique attribute for _count only) = 47.6 s
AttributeKeeper(unique attribute only) -> StatisticsCalculator = 31.3 s
Aggregator(Attributes only, drop attributes, build list, unique attribute only) -> ListElementCounter = 24.1 s
Raw PythonCaller keeping only an integer count = 5.3 s
I feel like getting the feature count for 125,000 features should really be faster than this. After all, it only takes about 160 s on this same machine to pump these features through a JSONTemplater with 2 sub-templates so I feel all the above options are doing excess work.
EDIT: I've now packaged up the PythonCaller code I used and published it on the Hub here
I gave the FeatureCounter an update, so give it a try again in 2020 (it's now version 3 of the transformer) and hopefully it will be quicker.
Another method would be:
But I gave that a try and it didn't seem any quicker, so I didn't change the transformer to use that method.