Delay selecting vertices after going form object to edit mode

Hi everyone!
Basically I got an over 100k polygon mesh and a script that go from object-mode to edit-mode, then I should select some vertices to delete, then i click a button and the mesh is exported in obj (returning in object-mode).
After the first export, I re-run the script to go from object-mode to edit-mode, it’s fast; but when i select some vertices Blender stop responding for like 7-8 seconds and then select the vertices.
I noticed that if I change from object to edit in the UI (not from script) it show a little delay (preparing the mesh to be ready to edit I think), I assume this “preparing the mesh” doesn’t happen after the script from object to edit maybe there’s difference using the UI (or TAB key) and using a script that should do the same thing.
I want to “prepare the mesh for edit” actually when i switch to edit-mode and not when i select some vertices, any clue about this?
Thanks!