Raised This Month: $32 Target: $400
 8% 

Infinite loops


Post New Thread Reply   
 
Thread Tools Display Modes
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-12-2009 , 17:04   Re: Infinite loops
Reply With Quote #11

Quote:
Originally Posted by Sean D View Post
also don't listen to anything hawk says, he doesn't know what he's talking about
Yeah, I don't, and I clearly said that. I just suggested what it could be based on what I knew about other languages.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-12-2009 , 17:10   Re: Infinite loops
Reply With Quote #12

Just curious what amxxdump would give :

PHP Code:
// while( true ) {}
0x58                      BREAK
0x5C                      BREAK
0x60                      BREAK
0x64                      JUMP  0x60

// for( ;; ) {}
0x78                      BREAK
0x7C                      BREAK
0x80                      JUMP  0x8C
0x88                      
BREAK
0x8C                      JUMP  0x88

// hello: goto hello
0xA0                      BREAK
0xA4                      BREAK
0xA8                      LCTRL  0x5
0xB0                      SCTRL  0x4
0xB8                      
BREAK
0xBC                      JUMP  0xA8 
Arkshine is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-12-2009 , 17:21   Re: Infinite loops
Reply With Quote #13

Looks like I was right after all for each of my predictions, at least for Pawn.

EDIT: Actually, I'm not sure how expensive LCTRL and SCTRL are, but if they're more expensive than a JUMP then yeah.
__________________

Last edited by Hawk552; 02-12-2009 at 17:34.
Hawk552 is offline
Send a message via AIM to Hawk552
Ingram
Veteran Member
Join Date: May 2004
Old 02-12-2009 , 18:06   Re: Infinite loops
Reply With Quote #14

If Hawk is right, I don't know what I am reading wrong. Once in the loops, they are exactly the same...

That jump beforehand could have also been dropped if it was optimized by the compiler.
Ingram is offline
OneEyed
AMX Mod X Beta Tester
Join Date: Jun 2005
Old 02-12-2009 , 18:15   Re: Infinite loops
Reply With Quote #15

What about

Code:
myFunc() 
{
      myFunc();
}
__________________
OneEyed is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-12-2009 , 19:08   Re: Infinite loops
Reply With Quote #16

amxxdump :

PHP Code:
0x2C                       PROC              stock myFunc()
0x30                       BREAK
0x34                       BREAK
0x38                       PUSH.C  0x0
0x40                       CALL  0x2C        
stock myFunc()
0x48                       ZERO.pri
0x4C                       RETN 

Last edited by Arkshine; 02-12-2009 at 19:12.
Arkshine is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-12-2009 , 19:25   Re: Infinite loops
Reply With Quote #17

Quote:
Originally Posted by Ingram View Post
If Hawk is right, I don't know what I am reading wrong. Once in the loops, they are exactly the same...

That jump beforehand could have also been dropped if it was optimized by the compiler.
Quote:
Originally Posted by Hawk552 View Post
BTW, the reason I think the while loop would be faster is that it only takes 1 parameter. A for loop is basically a while loop that has 2 extra parameters (action after each iteration and action prior to first iteration), so there's no reason a for loop would be faster.
Quote:
Originally Posted by Hawk552 View Post
EDIT: Actually, I'm not sure how expensive LCTRL and SCTRL are, but if they're more expensive than a JUMP then yeah.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Sean D
Junior Member
Join Date: Apr 2006
Old 02-12-2009 , 21:31   Re: Infinite loops
Reply With Quote #18



I TRUST THAT THIS SETTLES THE MATTER
Sean D is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-12-2009 , 21:50   Re: Infinite loops
Reply With Quote #19

Quote:
Originally Posted by Sean D View Post


I TRUST THAT THIS SETTLES THE MATTER
I believe it does, but it's still different in Pawn.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 02-12-2009 , 22:29   Re: Infinite loops
Reply With Quote #20

Quote:
Originally Posted by Hawk552 View Post
I believe it does, but it's still different in Pawn.
The only thing we learned from all this is that AMXX's compiler sucks.
__________________

Community / No support through PM
danielkza is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:04.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode