The 940mx is more powerful of the two.
4GB of VRAM for these "mainstream" GPUs is a waste since neither GPUs are powerful enough for games to use them even if the RAM is DDR5 rather than DDR3. Generally speaking, to be able to take advantage of 4GB of VRAM in games you need to play games at above 1080p and use ultra quality textures.
For example, in the Witcher 3 (a pretty demanding game) playing at 1366x768 resolution and a mix of low to high graphic settings, the 940mx will only give you around 30 - 35 FPS in combat. Lower if there are a lot of enemies.