Utils: replace IllegalArgumentException with assertion for better performance.