The way of get the count of the custom type

for there is no way to add @count to a custom type, I achieve it this way, it is slow when data is large .

q(func:type(User)) {
  count: count(uid)
}

Count index is an edge-only(relational edges, not value ones) feature. But what is the question? And what is custom type?

type Tweet {
  author
   text
}

like a tweet site, I want to show how many tweets on the homepage .

Use the count directive in the edge that goes to the Tweet. So you can have a way to count it easily.