Testing shows negligible difference as far as speed.
20:02:28.432 --------------------------- 20:02:29.612 Scaling test ran 10 times in 1159.1 ms. 20:02:30.769 Scaling test ran 10 times in 1157.3 ms. 20:02:31.925 Scaling test ran 10 times in 1154.4 ms. 20:02:33.073 Scaling test ran 10 times in 1155.5 ms. 20:02:34.235 Scaling test ran 10 times in 1157 ms. 20:02:34.235 --------------------------- 20:02:35.383 Sizing test ran 10 times in 1147.9 ms. 20:02:36.533 Sizing test ran 10 times in 1146.6 ms. 20:02:37.685 Sizing test ran 10 times in 1146 ms. 20:02:38.825 Sizing test ran 10 times in 1143.9 ms. 20:02:39.973 Sizing test ran 10 times in 1143.5 ms. 20:02:39.973 ---------------------------
Code here: https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2017/10/whichIsFasterScalingOrWidthHeight.zip
-- ============================================================= display.setStatusBar(display.HiddenStatusBar) io.output():setvbuf("no") -- ============================================================= require "ssk2.loadSSK" \_G.ssk.init( { useExternal = true } ) -- ============================================================= local group local objs local size = math.floor(fullh/60) local cols = 50 local rows = 50 local startX = left + size/2 local startY = top + size/2 local curX = startX local curY = startY local function createGrid() local objs = {} group = display.newGroup() for i = 1, cols do for j = 1, rows do objs[#objs+1] = display.newRect( group, curX, curY, size, size ) curX = curX + size end curX = startX curY = curY + size end return objs end local function scalingTest( numRuns ) local scales = { 1, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1 } numRuns = numRuns or 1 local scale local startTime = system.getTimer() for iter = 1, numRuns do for i = #scales, 1, -1 do local scale = scales[i] for j = 1, #objs do objs[j].xScale = scale objs[j].yScale = scale end end end local endTime = system.getTimer() local duration = endTime - startTime print("Scaling test ran ", numRuns, " times in ", endTime - startTime, " ms.") return duration end local function sizingTest( numRuns ) local scales = { 1, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1 } for i = 1, #scales do scales[i] = scales[i] \* size end numRuns = numRuns or 1 local scale local startTime = system.getTimer() for iter = 1, numRuns do for i = #scales, 1, -1 do local scale = scales[i] for j = 1, #objs do objs[j].width = scale objs[j].height = scale end end end local endTime = system.getTimer() local duration = endTime - startTime print("Sizing test ran ", numRuns, " times in ", endTime - startTime, " ms.") return duration end print ("---------------------------") objs = createGrid() scalingTest(10) scalingTest(10) scalingTest(10) scalingTest(10) scalingTest(10) display.remove(group) print ("---------------------------") objs = createGrid() sizingTest(10) sizingTest(10) sizingTest(10) sizingTest(10) sizingTest(10) display.remove(group) print ("---------------------------") --]]