The question is not well posed. Work is done only when there is an effect on the outside world. If the outside of the piston is vacuum, NO work is done. If the outside of the piston is under a pressure, then work is done lifting the outside atmosphere.
In any case the basic definition of work in this case is:
$$w = -\int_{V_1}^{V_2} p_{ext} dV$$
where $w$ is the work, $V_1$ is the initial volume of the system, and $V_2$ is the final volume of the system. Last, $p_{ext}$ is the external pressure.
In order to do this integral one must know how the external pressure changes as the internal volume changes. Thus it is easy if $p_{ext}$ is constant, but it is hard in general.
The speed of the expansion makes no difference at all, at least under the usual assumptions of thermodynamics which here are that the piston massless and frictionless. The speed of the expansion will affect the power generated by the process, but that's not part of thermodynamics.