flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > [fasmg] irpv too slow

Author
Thread Post new topic Reply to topic
MaoKo



Joined: 07 May 2019
Posts: 100
Location: Paris/French
MaoKo 21 Nov 2019, 14:53
Hello. In an irpv block, when your redefine the the target variable directly without indirection it's take twice or plus the initial time. On my machine, it's around 30 seconds.
Code:
A equ $01
repeat $10000
  irpv _, A
    redefine A _
  end irpv
end repeat
    

I don't know if it's a bug or not. If fasmg look ahead before the execution of irpv block to see if the target variable is edit, and if it's the case, the linked list associated with the target is copied, in such case I can understand the time consumption.
But with an indirection, everything goes in order.
Code:
A equ $01
macro __update? _?
  redefine A _
end macro
repeat $10000
  irpv _, A
    __update
  end irpv
end repeat
    

Hope this might help. Sorry for my english too. : )
Post 21 Nov 2019, 14:53
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 21 Nov 2019, 15:39
Thank you! This looks like it might be a bug of some sort, I need to investigate closely.
Post 21 Nov 2019, 15:39
View user's profile Send private message Visit poster's website Reply with quote
MaoKo



Joined: 07 May 2019
Posts: 100
Location: Paris/French
MaoKo 21 Nov 2019, 15:43
You're welcome : )
Post 21 Nov 2019, 15:43
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 21 Nov 2019, 16:51
I found what has been causing the problem. Please try release iqvlf.
Post 21 Nov 2019, 16:51
View user's profile Send private message Visit poster's website Reply with quote
MaoKo



Joined: 07 May 2019
Posts: 100
Location: Paris/French
MaoKo 22 Nov 2019, 02:37
Thx Tomasz it's work fine. But there is one thing that I can't understand and it's very weird.
Maybe I wrong, but probably there is a small issue with the time and unconditional macro expansion.
With this code:
Code:
macro __private?
end macro
macro abc?
        repeat $10
                if (1)
                esc __private
                else
                esc __private
                end if
        end repeat
end macro
repeat $20000
        abc
end repeat
    

Are we agree that normally with or without the ! in __private the macro abc is the same? However the time spent is not.
If I remove the "else", everything becomes normal again. I think that there is a thing with else. Whatever the else come from (match,rmatch) this is the same.
I don't known. It's seem nothing, (about 2 sec) but with some case it's about a diff of 10 sec or plus.
I hope Tomasz you can enlighten me : ).
Post 22 Nov 2019, 02:37
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 22 Nov 2019, 06:06
MaoKo wrote:
Are we agree that normally with or without the ! in __private the macro abc is the same? However the time spent is not.
No, it's not the same. When __private macro is unconditional, it is evaluated even in the skipped ELSE block and this is what makes the difference (and your ESC only suppresses evaluation while the macro is being defined, by the time the macro is called and IF interpreted, there is no longer ESC there).
In general, unconditional macros are certainly bad for performance, because they are evaluated everywhere. That's what they do.

PS. I don't know if this could be applied to your specific case, but you could suppress the unconditional evaluation in the ELSE block by hiding it in a normal, "conditional" macro:
Code:
macro __private?!
end macro

macro hidden
        esc __private
end macro

macro abc?
        repeat $10
                if (1)
                        esc __private
                else
                        hidden
                end if
        end repeat
end macro
repeat $20000
        abc
end repeat    
Post 22 Nov 2019, 06:06
View user's profile Send private message Visit poster's website Reply with quote
MaoKo



Joined: 07 May 2019
Posts: 100
Location: Paris/French
MaoKo 23 Nov 2019, 20:27
Yes, I'm sorry. When writing this macro, I have totally forgot the expansion of "!" macro in else block Sad.
I try to optimize as fast as possible my irps macro with different implementation. I hope I can gain few second with this.
Thx.
Post 23 Nov 2019, 20:27
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.