Re: Flex never-interactive mode
| From: | Rasmus Lerdorf | Date: | Wed, 26 Feb 2003 21:33:30 +0000 |
| Subject: | Re: Flex never-interactive mode | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-94606@lists.php.net to get a copy of this message | ||
On Wed, 26 Feb 2003, Andi Gutmans wrote:
> At 12:48 PM 2/26/2003 -0800, Rasmus Lerdorf wrote:
> >I think we can add "%option never-interactive" to the ini-scanner lexer to
> >speed it up a tiny little bit. Speeding up the ini scanner might be
> >important for the folks running the cgi version. More importantly, to me
> >anyway, when we know we are not interactive, should we not
> >programmatically set is_interactive to false for the language scanner as
> >well? I did this here and the ioctl syscalls that come from the isatty()
> >calls in the lexer dropped away speeding things up nicely.
>
> Do you have any figures? (req/s wise)
> I think we can set it to false when we know we're not interactive. It
> shouldn't be a problem.
Not really. I've hacked and slashed a bunch of things and this is just
one of them. I could pull out just this change and try to time it, I
guess. But it can't help but be faster just by looking at the syscall
profiles before and after the change. On a simple Hello World script
before the change you have this: (PHP 4.2 with realpath turned off)
83757 apache 0.000010 CALL __getcwd(0x9fbfe674,0xfff)
83757 apache 0.000010 RET __getcwd 0
83757 apache 0.000010 CALL chdir(0x9fbfe614)
83757 apache 0.000030 RET chdir 0
83757 apache 0.000023 CALL open(0x167588,0,0x1b6)
83757 apache 0.000031 RET open 5
83757 apache 0.000009 CALL __getcwd(0x9fbfdc14,0x400)
83757 apache 0.000032 RET __getcwd 0
83757 apache 0.000031 CALL ioctl(0x5,TIOCGETA,0x9fbfe4e4)
83757 apache 0.000010 RET ioctl -1 errno 25 Inappropriate ioctl for device
83757 apache 0.000034 CALL fstat(0x5,0x9fbfd42c)
83757 apache 0.000010 RET fstat 0
83757 apache 0.000008 CALL read(0x5,0x148000,0x2000)
83757 apache 0.000023 RET read 42/0x2a
83757 apache 0.000008 CALL read(0x5,0x148000,0x2000)
83757 apache 0.000013 RET read 0
83757 apache 0.000046 CALL ioctl(0x5,TIOCGETA,0x9fbfd4c0)
83757 apache 0.000009 RET ioctl -1 errno 25 Inappropriate ioctl for device
83757 apache 0.000020 CALL close(0x5)
83757 apache 0.000010 RET close 0
83757 apache 0.000053 CALL setitimer(0,0x9fbfe29c,0x9fbfe28c)
83757 apache 0.000014 RET setitimer 0
83757 apache 0.000059 CALL setitimer(0,0x9fbfe29c,0x9fbfe28c)
83757 apache 0.000009 RET setitimer 0
83757 apache 0.000026 CALL chdir(0x9fbfe674)
83757 apache 0.000030 RET chdir 0
The 3rd column there is the time it took for the call. A failed ioctl is
one of the heavier syscalls and both of the ioctls disappear for this
request when you turn off is_interactive. The ioctls are the same in 4.3.
Here is what I am currently down to in 4.3. I still need to get rid of
that one lseek and am hoping to nuke the fstat as well. I also need to
figure out why setitimer is being called more in 4.3 than it was in 4.2.
88046 apache 0.000009 CALL __getcwd(0x9fbfe654,0xfff)
88046 apache 0.000013 RET __getcwd 0
88046 apache 0.000009 CALL chdir(0x9fbfe5f4)
88046 apache 0.000032 RET chdir 0
88046 apache 0.000010 CALL setitimer(0x2,0x9fbfe63c,0)
88046 apache 0.000008 RET setitimer 0
88046 apache 0.000008 CALL setitimer(0x2,0x9fbfe61c,0)
88046 apache 0.000006 RET setitimer 0
88046 apache 0.000028 CALL sigaction(0x1b,0x9fbfe5b4,0x9fbfe59c)
88046 apache 0.000008 RET sigaction 0
88046 apache 0.000007 CALL sigprocmask(0x2,0x9fbfe60c,0)
88046 apache 0.000006 RET sigprocmask 0
88046 apache 0.000030 CALL open(0x12ce0c,0,0x1b6)
88046 apache 0.000033 RET open 5
88046 apache 0.000021 CALL lseek(0x5,0,0,0,0)
88046 apache 0.000008 RET lseek 0
88046 apache 0.000043 CALL fstat(0x5,0x9fbfd40c)
88046 apache 0.000013 RET fstat 0
88046 apache 0.000009 CALL read(0x5,0x13f000,0x2000)
88046 apache 0.000022 RET read 42/0x2a
88046 apache 0.000006 CALL read(0x5,0x13f000,0x2000)
88046 apache 0.000015 RET read 0
88046 apache 0.000066 CALL close(0x5)
88046 apache 0.000015 RET close 0
88046 apache 0.000047 CALL setitimer(0,0x9fbfdf7c,0x9fbfdf6c)
88046 apache 0.000012 RET setitimer 0
88046 apache 0.000043 CALL setitimer(0,0x9fbfdf7c,0x9fbfdf6c)
88046 apache 0.000009 RET setitimer 0
88046 apache 0.000021 CALL chdir(0x9fbfe654)
88046 apache 0.000031 RET chdir 0
-Rasmus