if ls -1qAA1q ./somedir/ | grep -q .
then ! echo somedir is not empty
else echo somedir is empty
fi
The above is a POSIX-compatible test - and should be very fast. ls will list all files/dirs in a directory excepting . and .. (from -A) each one per line (from -1) and will -quote all non-printable characters (to include \newlines) in the output with a ? question-mark. In this way if grep receives even a single character in input it will return true - else false.
To do it in a POSIX-shell alone:
cd ./somedir/ || exit
set ./* ./.[!.]* ./..?*
if [ -n "$4" ] ||
for e do
[ -L "$e" ] ||
[ -e "$e" ] && break
done
then ! echo somedir is not empty
else echo somedir is empty
fi
cd "$OLDPWD"
A POSIX-shell (which has not earlier disabled -filename generation) will set the "$@" positional-parameter array to either the literal strings followed by the set command above, or else to the fields generated by glob operators at the end of each. Whether it does so is dependent upon whether the globs actually match anything. In some shells you can instruct a non-resolving glob to expand to null - or nothing at all. This can sometimes be beneficial, but it is not portable and often comes with additional problems - such as having to set special shell-options and afterwards unset them.
The only portable means of handling null-valued arguments involve either empty or unset variables or ~ tilde-expansions. And the latter, by the way, is far safer than the former.
Above the shell only tests any of the files for -existence if neither of the three globs specified resolves to more than a single a match. So the for loop is only ever run at all for three or fewer iterations, and only in the case of an empty directory, or in the case that one or more of the patterns resolves only to a single file. The for also breaks if any of the globs represent an actual file - and as I have arranged the globs in the order of most likely to least likely, it should pretty much quit on the first iteration every time.
Either way you do it should involve only a single system stat() call - the shell and ls should both only need to stat() the directory queried and list out the files its dentries report that it contains. This is contrasted by the behavior of find which would instead stat() every file you might list with it.