*Minor differences ignored. Grouped by changes, with first version listed as example.
When the waves of death compassed me - Though in a primary sense many of these things belong to David, yet generally and fully they belong to the Messiah alone.
When the (c) waves of death compassed me, the floods of ungodly men made me afraid;
(c) As David (who was the figure of Christ) was by God's power delivered from all dangers: so Christ and his Church will overcome most grievous dangers, tyranny and death.
When the waves of death compassed me, the floods of ungodly men made me afraid. See Gill on Psalm 18:4.
5 For breakers of death had compassed me,
Streams of wickedness terrified me.
6 Cords of hell had girt me about,
Snares of death overtook me.
7 In my distress I called Jehovah,
And to my God I called;
And He heard my voice out of His temple,
And my crying came into His ears.
David had often been in danger of death, most frequently at the time when he was pursued by Saul, but also in Absalom's conspiracy, and even in several wars (cf. 2-Samuel 21:16). All these dangers, out of which the Lord delivered him, and not merely those which originated with Saul, are included in 2-Samuel 22:5, 2-Samuel 22:6. The figure "breakers or waves of death" is analogous to that of the "streams of Belial." His distress is represented in both of them under the image of violent floods of water. In the psalm we find מות חבלי, "snares of death," as in Psalm 116:3, death being regarded as a hunger with a net and snare (cf. Psalm 91:3): this does not answer to well to the parallel נחלי, and therefore is not so good, since שׁאול חבלי follows immediately. בליּעל (Belial), uselessness in a moral sense, or worthlessness. The meaning "mischief," or injury in a physical sense, which many expositors give to the word in this passage on account of the parallel "death," cannot be grammatically sustained. Belial was afterwards adopted as a name for the devil (2-Corinthians 6:15). Streams of wickedness are calamities that proceed from wickedness, or originate with worthless men. קדּם, to come to meet with a hostile intention, i.e., to fall upon (vid., Job 30:27). היכל, the temple out of which Jehovah heard him, was the heavenly abode of God, as in Psalm 11:4; for, according to 2-Samuel 22:8., God came down from heaven to help him.
*More commentary available at chapter level.