Running the function or running the two commands separately does not make any measurable difference in execution time.
My guess would be that you ran the function, found that it was slow, then tried the commands separately.
If you did that, then it's likely that the first time, the data was not present in the disk cache, so what you measured was the time to load the data from the disk. The second time, the data was already in the disk cache (because you had just accessed it), so you measured the time to copy the data around in memory.
To do proper benchmarks, you need to start all measurements in the same conditions: either you know that all the data is in the cache, or you know that all the data has to be loaded from the disk.
Copying the data and then removing the original is a really weird way of doing this. Run mv instead! It's instantaneous if you've moving the files inside the same filesystem.
Furthermore, rm * is a very unusual command. If you don't need a directory anymore, remove the directory: rm -r somedir or mv somedir ~/trash/.
cprecursively, but notrmrecursively. Are you sure that is what you want?cp * /path/to/trash/mvinstead.trashcommand from thetrash-clipackage might be useful for you.