Currently TRIM is optimized to only calculate the length of the trimmed string - and not create a clone of the data. It would be possible to do the same for TRIM(x, LEFT) by offsetting the start, and then calculating the trimmed length
i.e. TRIM(str) could be implemented as (pseudo code):
It would be good to check if TRIM(x, RIGHT) is also currently optimized.