You could try some tricks based on specific optimizations done in current versions of fasm. For example, if you look at "reserve_bytes:" handler in ASSEMBLE.INC you can find this piece:
cmp [next_pass_needed],0
je zero_bytes
add edi,ecx
jmp reserved_data
This means that RB does not actually zero the data unless the assembler believes it is the final pass. This allows to make this kind of test:
; Warning: tricky stuff relying on quirks of fasm 1 implementation
postpone {
rb 1
load a byte from $-1
if a = 0
; dummy code for testing, if it is assembled more than once,
; the time difference should be noticeable
repeat 10000000
a = a + 1
end repeat
end if
}
Note that the code needs to be at the end of source, here ensured by POSTPONE, so that the decision to take the next pass has been already taken if necessary.