To show and hide the dock instantly, open Terminal and run:
defaults write com.apple.dock autohide-delay -float 0 && defaults write com.apple.dock autohide-time-modifier -float 0 && killall DockTo get back the default animation and delay before showing the dock, run:
defaults delete com.apple.dock autohide-delay && defaults delete com.apple.dock autohide-time-modifier && killall DockThis works on M1 macs on macOS 12.0 Monterey.
Before running these commands, ensure that the "Automatically hide and show the Dock" setting is enabled. Find this setting in System Preferences > Dock & Menu Bar.