huge problem with top(45degrees)point view game

I am trying to Create a semi top view game and I had problems when objects with different speed overlap and the one that should be on top was under

So i figured a function that sorts the objects in the group according to their y position ,

local function sortGroup()

      local function comp(a,b)

           return a.y>b.y

      end

      table.sort(spriteGroupA,comp)

end

Runtime(“enterFrame”,sortGroup)

    or

timer.performWithDelay(500,sortGroup,0)

However there will be quite a lot of objects so would sorting them each frame be a burden to the device processor?

then howabout sorting them every 15 frames or 10 maybe ?