From owner-freebsd-hackers@FreeBSD.ORG Fri May 4 14:07:57 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2B68516A411 for ; Fri, 4 May 2007 14:07:57 +0000 (UTC) (envelope-from valiy-td@mail.ru) Received: from mx27.mail.ru (mx27.mail.ru [194.67.23.64]) by mx1.freebsd.org (Postfix) with ESMTP id 7138213C480 for ; Fri, 4 May 2007 14:07:56 +0000 (UTC) (envelope-from valiy-td@mail.ru) Received: from [195.218.186.80] (port=41220 helo=[195.218.186.80]) by mx27.mail.ru with asmtp id 1HjyRs-0001nu-00 for freebsd-hackers@freebsd.org; Fri, 04 May 2007 18:07:52 +0400 Message-ID: <463B3D49.7090101@mail.ru> Date: Fri, 04 May 2007 18:03:53 +0400 From: valiy User-Agent: Thunderbird 1.5.0.2 (X11/20060519) MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: 7bit Subject: FreeBSD 6.1 6.2 C++ stl set.clear() very slow X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 May 2007 14:07:57 -0000 test prog: #include #include #include #include timeval bgn, end; int main() { std::set s; printf("filling\n"); gettimeofday(&bgn, NULL); for (int i = 0; i < (1<<20); i++) { s.insert((rand() << 16) + rand()); } gettimeofday(&end, NULL); float t1 = float (end.tv_sec - bgn.tv_sec) + float (end.tv_usec - bgn.tv_usec) / 1000000.0f; printf("clearing\n"); gettimeofday(&bgn, NULL); s.clear(); gettimeofday(&end, NULL); float t2 = float (end.tv_sec - bgn.tv_sec) + float (end.tv_usec - bgn.tv_usec) / 1000000.0f; printf("done\n"); printf("alloc time %.3f\tclear time %.3f\n", t1, t2); } TEST1 FreeBSD idx 6.1-RELEASE-p10 FreeBSD 6.1-RELEASE-p10 #1: Wed Nov 8 18:59:20 UTC 2006 root@idx:/usr/src/sys/amd64/compile/SMP amd64 19:07:15 root@idx3 ~ $ g++ ./test_set.cpp 19:07:23 root@idx3 ~ $ ./a.out filling clearing done alloc time 1.938 clear time 15.290 dmesg: Copyright (c) 1992-2006 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD 6.1-RELEASE-p10 #1: Wed Nov 8 18:59:20 UTC 2006 root@idx3.mail.ru:/usr/src/sys/amd64/compile/SMP ACPI APIC Table: Timecounter "i8254" frequency 1193182 Hz quality 0 CPU: Dual Core AMD Opteron(tm) Processor 275 (2200.01-MHz K8-class CPU) Origin = "AuthenticAMD" Id = 0x20f12 Stepping = 2 Features=0x178bfbff Features2=0x1 AMD Features=0xe2500800 AMD Features2=0x3 Cores per package: 2 real memory = 6979321856 (6656 MB) avail memory = 6215618560 (5927 MB) FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs cpu0 (BSP): APIC ID: 0 cpu1 (AP): APIC ID: 1 cpu2 (AP): APIC ID: 2 cpu3 (AP): APIC ID: 3 ioapic0 irqs 0-23 on motherboard ioapic1 irqs 24-47 on motherboard kbd1 at kbdmux0 acpi0: on motherboard acpi0: Power Button (fixed) acpi0: reservation of dfefd000, 400 (3) failed acpi0: reservation of dfefe000, 400 (3) failed acpi0: reservation of dfeff000, 1000 (3) failed Timecounter "ACPI-safe" frequency 3579545 Hz quality 1000 acpi_timer0: <24-bit timer at 3.579545MHz> port 0x4008-0x400b on acpi0 cpu0: on acpi0 cpu1: on acpi0 cpu2: on acpi0 cpu3: on acpi0 pcib0: port 0xcf8-0xcff on acpi0 pci0: on pcib0 pci0: at device 0.0 (no driver attached) isab0: at device 1.0 on pci0 isa0: on isab0 pci0: at device 1.1 (no driver attached) ohci0: mem 0xfe4fd000-0xfe4fdfff irq 20 at device 2.0 on pci0 ohci0: [GIANT-LOCKED] usb0: OHCI version 1.0, legacy support usb0: SMM does not respond, resetting usb0: on ohci0 usb0: USB revision 1.0 uhub0: nVidia OHCI root hub, class 9/0, rev 1.00/1.00, addr 1 uhub0: 10 ports with 10 removable, self powered ehci0: mem 0xfe4e0000-0xfe4e00ff irq 21 at device 2.1 on pci0 ehci0: [GIANT-LOCKED] usb1: EHCI version 1.0 usb1: companion controller, 4 ports each: usb0 usb1: on ehci0 usb1: USB revision 2.0 uhub1: nVidia EHCI root hub, class 9/0, rev 2.00/1.00, addr 1 uhub1: 10 ports with 10 removable, self powered atapci0: port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0x3000-0x300f at device 6.0 on pci0 ata0: on atapci0 ata1: on atapci0 atapci1: port 0xcc00-0xcc07,0xc800-0xc803,0xc400-0xc407,0xc000-0xc003,0xbc00-0xbc0f mem 0xfe4ff000-0xfe4fffff irq 22 at device 7.0 on pci0 ata2: on atapci1 ata3: on atapci1 atapci2: port 0xb800-0xb807,0xb400-0xb403,0xb000-0xb007,0xac00-0xac03,0xa800-0xa80f mem 0xfe4fe000-0xfe4fefff irq 20 at device 8.0 on pci0 ata4: on atapci2 ata5: on atapci2 pcib1: at device 9.0 on pci0 pci5: on pcib1 pci5: at device 4.0 (no driver attached) pcib2: at device 11.0 on pci0 pci4: on pcib2 pcib3: at device 12.0 on pci0 pci2: on pcib3 bge0: mem 0xfc1f0000-0xfc1fffff irq 17 at device 0.0 on pci2 miibus0: on bge0 brgphy0: on miibus0 brgphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseTX, 1000baseTX-FDX, auto bge0: Ethernet address: 00:30:48:57:59:70 pcib4: at device 13.0 on pci0 pci3: on pcib4 bge1: mem 0xfc2f0000-0xfc2fffff irq 18 at device 0.0 on pci3 miibus1: on bge1 brgphy1: on miibus1 brgphy1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseTX, 1000baseTX-FDX, auto bge1: Ethernet address: 00:30:48:57:59:71 pcib5: at device 14.0 on pci0 pci1: on pcib5 pcib6: on acpi0 pci128: on pcib6 pci128: at device 0.0 (no driver attached) pci128: at device 1.0 (no driver attached) atapci3: port 0xfc00-0xfc07,0xf800-0xf803,0xf400-0xf407,0xf000-0xf003,0xec00-0xec0f mem 0xfe6ff000-0xfe6fffff irq 44 at device 7.0 on pci128 ata6: on atapci3 ata7: on atapci3 atapci4: port 0xe800-0xe807,0xe400-0xe403,0xe000-0xe007,0xdc00-0xdc03,0xd800-0xd80f mem 0xfe6fe000-0xfe6fefff irq 45 at device 8.0 on pci128 ata8: on atapci4 ata9: on atapci4 pcib7: at device 13.0 on pci128 pci130: on pcib7 pcib8: at device 14.0 on pci128 pci129: on pcib8 acpi_button0: on acpi0 sio0: configured irq 4 not in bitmap of probed irqs 0 sio0: port may not be enabled sio0: <16550A-compatible COM port> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0 sio0: type 16550A sio1: configured irq 3 not in bitmap of probed irqs 0 sio1: port may not be enabled sio1: <16550A-compatible COM port> port 0x2f8-0x2ff irq 3 on acpi0 sio1: type 16550A fdc0: port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on acpi0 fdc0: [FAST] fd0: <1440-KB 3.5" drive> on fdc0 drive 0 ppc0: port 0x378-0x37f irq 7 on acpi0 ppc0: Generic chipset (NIBBLE-only) in COMPATIBLE mode ppbus0: on ppc0 plip0: on ppbus0 lpt0: on ppbus0 lpt0: Interrupt-driven port ppi0: on ppbus0 atkbdc0: port 0x60,0x64 irq 1 on acpi0 atkbd0: flags 0x1 irq 1 on atkbdc0 kbd0 at atkbd0 atkbd0: [GIANT-LOCKED] orm0: at iomem 0xc0000-0xc7fff,0xc8000-0xc97ff,0xc9800-0xcafff on isa0 sc0: at flags 0x100 on isa0 sc0: VGA <16 virtual consoles, flags=0x300> vga0: at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0 Timecounters tick every 1.000 msec module_register_init: MOD_LOAD (amr_linux, 0xffffffff80622180, 0) error 6 ipfw2 (+ipv6) initialized, divert loadable, rule-based forwarding disabled, default to accept, logging disabled acd0: CDROM at ata0-master UDMA33 ad4: 76319MB at ata2-master SATA300 ad8: 381554MB at ata4-master SATA300 ad10: 381554MB at ata5-master SATA300 ad12: 381554MB at ata6-master SATA300 ad14: 381554MB at ata7-master SATA300 ad16: 381554MB at ata8-master SATA150 ad18: 381554MB at ata9-master SATA150 SMP: AP CPU #1 Launched! SMP: AP CPU #3 Launched! SMP: AP CPU #2 Launched! Trying to mount root from ufs:/dev/ad4s1a bge0: link state changed to UP TEST2 FreeBSD proton 5.5-RELEASE FreeBSD 5.5-RELEASE #0: Mon Jun 26 21:47:56 MSD 2006 root@proton:/usr/src/sys/i386/compile/PROTON i386 [root@proton ~]# g++ test_set.cpp [root@proton ~]# ./a.out filling clearing done alloc time 2.529 clear time 5.685 dmesg :kernel boot file is /boot/kernel/kernel Copyright (c) 1992-2006 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD 5.5-RELEASE #0: Mon Jun 26 21:47:56 MSD 2006 root@proton:/usr/src/sys/i386/compile/PROTON ACPI APIC Table: Timecounter "i8254" frequency 1193182 Hz quality 0 CPU: Intel(R) Xeon(TM) CPU 2.80GHz (2800.12-MHz 686-class CPU) Origin = "GenuineIntel" Id = 0xf43 Stepping = 3 Features=0xbfebfbff Hyperthreading: 2 logical CPUs real memory = 7516192768 (7168 MB) avail memory = 6290010112 (5998 MB) FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs cpu0 (BSP): APIC ID: 0 cpu1 (AP): APIC ID: 1 cpu2 (AP): APIC ID: 6 cpu3 (AP): APIC ID: 7 ioapic0 irqs 0-23 on motherboard ioapic1 irqs 24-47 on motherboard ioapic2 irqs 48-71 on motherboard acpi0: on motherboard acpi0: Power Button (fixed) Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000 acpi_timer0: <24-bit timer at 3.579545MHz> port 0x1008-0x100b on acpi0 cpu0: on acpi0 cpu1: on acpi0 cpu2: on acpi0 cpu3: on acpi0 pcib0: port 0xcf8-0xcff on acpi0 pci0: on pcib0 pci0: at device 0.1 (no driver attached) pci0: at device 1.0 (no driver attached) pcib1: irq 16 at device 2.0 on pci0 pci1: on pcib1 pcib2: irq 16 at device 3.0 on pci0 pci2: on pcib2 pcib3: at device 0.0 on pci2 pci3: on pcib3 ahd0: port 0x2000-0x20ff,0x2400-0x24ff mem 0xdd200000-0xdd201fff irq 32 at device 2.0 on pci3 aic7902: Ultra320 Wide Channel A, SCSI Id=7, PCI-X 67-100Mhz, 512 SCBs ahd1: port 0x2800-0x28ff,0x2c00-0x2cff mem 0xdd202000-0xdd203fff irq 33 at device 2.1 on pci3 aic7902: Ultra320 Wide Channel B, SCSI Id=7, PCI-X 67-100Mhz, 512 SCBs pci2: at device 0.1 (no driver attached) pcib4: at device 0.2 on pci2 pci4: on pcib4 em0: port 0x3000-0x303f mem 0xdd300000-0xdd31ffff irq 54 at device 2.0 on pci4 em0: Ethernet address: 00:30:48:2f:b0:e2 em1: port 0x3040-0x307f mem 0xdd320000-0xdd33ffff irq 55 at device 2.1 on pci4 em1: Ethernet address: 00:30:48:2f:b0:e3 pci2: at device 0.3 (no driver attached) pcib5: irq 16 at device 4.0 on pci0 pci5: on pcib5 pcib6: irq 16 at device 6.0 on pci0 pci6: on pcib6 pci0: at device 29.0 (no driver attached) pci0: at device 29.1 (no driver attached) pci0: at device 29.2 (no driver attached) pci0: at device 29.3 (no driver attached) pci0: at device 29.7 (no driver attached) pcib7: at device 30.0 on pci0 pci7: on pcib7 pci7: at device 1.0 (no driver attached) isab0: at device 31.0 on pci0 isa0: on isab0 atapci0: port 0x14a0-0x14af,0x376,0x170-0x177,0x3f6,0x1f0-0x1f7 at device 31.1 on pci0 ata0: channel #0 on atapci0 ata1: channel #1 on atapci0 pci0: at device 31.3 (no driver attached) acpi_button0: on acpi0 ppc0: port 0x778-0x77f,0x378-0x37f irq 7 drq 1 on acpi0 ppc0: Generic chipset (ECP/PS2/NIBBLE) in COMPATIBLE mode ppc0: FIFO with 16/16/8 bytes threshold ppbus0: on ppc0 plip0: on ppbus0 lpt0: on ppbus0 lpt0: Interrupt-driven port ppi0: on ppbus0 atkbdc0: port 0x64,0x60 irq 1 on acpi0 atkbd0: irq 1 on atkbdc0 kbd0 at atkbd0 sio0: <16550A-compatible COM port> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0 sio0: type 16550A sio1: <16550A-compatible COM port> port 0x2f8-0x2ff irq 3 on acpi0 sio1: type 16550A fdc0: port 0x3f7,0x3f0-0x3f5 irq 6 drq 2 on acpi0 fd0: <1440-KB 3.5" drive> on fdc0 drive 0 npx0: on motherboard npx0: INT 16 interface orm0: at iomem 0xc9000-0xd2fff,0xc8000-0xc8fff,0xc0000-0xc7fff on isa0 pmtimer0 on isa0 sc0: at flags 0x100 on isa0 sc0: VGA <16 virtual consoles, flags=0x300> vga0: at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0 Timecounters tick every 10.000 msecda0: Fixed Direct Access SCSI-3 device da0: 320.000MB/s transfers (160.000MHz, offset 127, 16bit), Tagged Queueing Enabled da0: 70136MB (143638992 512 byte sectors: 255H 63S/T 8941C) da1 at ahd0 bus 0 target 1 lun 0 da1: Fixed Direct Access SCSI-3 device da1: 320.000MB/s transfers (160.000MHz, offset 127, 16bit), Tagged Queueing Enabled da1: 286102MB (585937500 512 byte sectors: 255H 63S/T 36472C) da2 at ahd0 bus 0 target 2 lun 0 da2: Fixed Direct Access SCSI-3 device da2: 320.000MB/s transfers (160.000MHz, offset 127, 16bit), Tagged Queueing Enabled da2: 286102MB (585937500 512 byte sectors: 255H 63S/T 36472C) da3 at ahd1 bus 0 target 0 lun 0 da3: Fixed Direct Access SCSI-3 device da3: 320.000MB/s transfers (160.000MHz, offset 127, 16bit), Tagged Queueing Enabled da3: 35074MB (71833096 512 byte sectors: 255H 63S/T 4471C) da4 at ahd1 bus 0 target 1 lun 0 da4: Fixed Direct Access SCSI-3 device da4: 320.000MB/s transfers (160.000MHz, offset 127, 16bit), Tagged Queueing Enabled da4: 286102MB (585937500 512 byte sectors: 255H 63S/T 36472C) da5 at ahd1 bus 0 target 2 lun 0 da5: Fixed Direct Access SCSI-3 device da5: 320.000MB/s transfers (160.000MHz, offset 127, 16bit), Tagged Queueing Enabled da5: 35068MB (71819496 512 byte sectors: 255H 63S/T 4470C) SMP: AP CPU #3 Launched! SMP: AP CPU #1 Launched! SMP: AP CPU #2 Launched! ipfw2 initialized, divert disabled, rule-based forwarding disabled, default to accept, logging disabled Waiting 15 seconds for SCSI devices to settle da0 at ahd0 bus 0 target 0 lun 0 da0: Fixed Direct Access SCSI-3 device TEST3: FreeBSD hotdog 4.9-RELEASE FreeBSD 4.9-RELEASE #3: Fri Jul 1 19:35:10 MSD 2005 root@hotdog:/usr/src/sys/compile/HOTDOG i386 19:18 root@puma vvolodin $ ./a.out filling clearing done alloc time 4.001 clear time 0.305 pentium3 2x700MHz how to fix?