Very slow sed...

David Cross dcross at okcupid.com
Wed Jun 20 14:37:23 UTC 2007


Ok the subject line is misleading.. but I don't know how else to put it. 
I have a machine on which SOME programs are slow.  VERY SLOW.  Other 
programs run just fine.  I cannot seem to find the source of the problem.

Machine 1 (the ok machine) is running 6.2-RELEASE-pLATEST.  It is a
CPU: Intel(R) Core(TM)2 CPU          6300  @ 1.86GHz (1862.11-MHz K8-class 
CPU)
   Origin = "GenuineIntel"  Id = 0x6f6  Stepping = 6

Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,C
MOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>

Features2=0xe3bd<SSE3,RSVD2,MON,DS_CPL,VMX,EST,TM2,<b9>,CX16,<b14>,<b15>>
   AMD Features=0x20100800<SYSCALL,NX,LM>
   AMD Features2=0x1<LAHF>
   Cores per package: 2
real memory  = 2145427456 (2046 MB)
avail memory = 2060214272 (1964 MB)
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
  cpu0 (BSP): APIC ID:  0
  cpu1 (AP): APIC ID:  1

Machine 2 (the slow machine) is running 6.2-RELEASE-pLATEST.  It is a
CPU: Intel(R) Core(TM)2 CPU          6320  @ 1.86GHz (1876.00-MHz K8-class 
CPU)
   Origin = "GenuineIntel"  Id = 0x6f6  Stepping = 6

Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,C
MOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
   Features2=0xe3bd<SSE3,RSVD2,MON,DS_CPL,VMX,EST,TM2,<b9>,CX16,XTPR,<b15>>
   AMD Features=0x20100800<SYSCALL,NX,LM>
   AMD Features2=0x1<LAHF>
   Cores per package: 2
real memory  = 4764729344 (4544 MB)
avail memory = 4063408128 (3875 MB)
ACPI APIC Table: <INTEL  DP965LT >
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
  cpu0 (BSP): APIC ID:  0
  cpu1 (AP): APIC ID:  1


Both are compiled with the exact same CFLAGS/COPTFLAGS (though it doesn't 
matter WHAT I compile it with, its still SLOW on many operations, thou 
fine on others).

For example:

Machine 1:
dd bs=22 if=X11-lib32.tar.bz2 | cat >/dev/null
2571071+1 records in
2571071+1 records out
56563575 bytes transferred in 23.048543 secs (2454106 bytes/sec)

Machine 2:
dd bs=22 if=X11-lib32.tar.bz2 | cat >/dev/null
2571071+1 records in
2571071+1 records out
56563575 bytes transferred in 24.052331 secs (2351688 bytes/sec)

Machine 1:
openssl speed
aes-128 cbc      91791.47k    94887.05k    96138.47k    96574.02k 
96623.36k
aes-192 cbc      80654.04k    84248.16k    85304.90k    85590.38k 
85589.09k
aes-256 cbc      72706.24k    75476.05k    75957.00k    76046.60k 
76020.44k


Machine 2:
openssl speed
aes-128 cbc      92457.48k    95876.89k    96900.91k    97227.52k 
97223.53k
aes-192 cbc      80875.87k    84916.79k    85773.97k    85996.90k 
85978.43k
aes-256 cbc      72943.78k    75833.00k    76466.32k    76631.74k 
76642.40k


Machine 1:
time sed -f 
/usr/src/gnu/usr.bin/groff/tmac/../../../../contrib/groff/tmac/strip.sed 
/usr/src/gnu/usr.bin/groff/tmac/../../../../contrib/groff/tmac/doc-common 
> /dev/null

real    0m0.059s
user    0m0.013s
sys     0m0.000s

Machine 2:
time sed -f 
/usr/src/gnu/usr.bin/groff/tmac/../../../../contrib/groff/tmac/strip.sed 
/usr/src/gnu/usr.bin/groff/tmac/../../../../contrib/groff/tmac/doc-common 
> /dev/null

real    0m4.506s
user    0m4.167s
sys     0m0.000s

Yes... you read that right... almost 400 _TIMES_ slower.  WTF..

Where should I be looking?

-- 
David E. Cross


More information about the freebsd-hackers mailing list