Optimizing search using grep

I have a huge log file close to 3GB in size.

My task is to generate some reporting based on # of times something is being logged.

I need to find the number of time StringA , StringB , StringC is being called separately.

What I am doing right now is:

grep "StringA" server.log | wc -l
grep "StringB" server.log | wc -l
grep "StringC" server.log | wc -l

This is a long process and my script takes close to 10 minutes to complete. What I want to know is that whether this can be optimized or not ? Is is possible to run one grep command and find out the number of time StringA, StringB and StringC has been called individually ?

This much I understand, you do not want to read the log file three times and that's what you got so far.

Are you tallying the result as StringA_count + StringB_count + StringC ?
If StringA and StringB or any combination is in the same line, does it count as two, three, one or none?

By the way, grep doesn't need wc -l to tell the count grep -c will do

StringA can occur along with StringB
StringA can occur along with StringC

StringB and StringC cannot occur along in the same line.

Still you haven't said about the output.

Let's assume your log has the following:

cat junaid_subhani.log
StringA and StringB and StringC counts as none
StringA and StringB counts as two times
StringB and StringA counts as two times
StringA alone counts as one time
StringB and StringC counts as none
StringB alone counts as one time
StringC alone counts as one time
StringC and StringB counts as none

variable total equals seven. Is this correct?

If not, please, post a representative portion of your log file and current script.

awk '
/StringA/ { a++ }
/StringB/ { b++ }
/StringC/ { c++ }
END {
  print a+0
  print b+0
  print c+0
}
' server.log