Setting keyframe on all vertices of a mesh I'm modelling a sea wave-field by animating the vertical positions of vertices (https://youtu.be/mWC9Gd0aSmo). This works but is very slow as I have a lot of vertices.

The code that I use now is:

mesh.vertices.foreach_set("co", vertices)
for vertex in mesh.vertices:
    vertex.keyframe_insert(data_path="co", frame = i_frame)



I was hoping that there is a way to avoid the loop and to set a keyframe on all the vertices at once.
I'm not sure that's the best way to go about that issue, vertex animations are a lot of trouble, it's better to use a wave modifier to get that result.