C++ Strings vs. Char Arrays
WHICH USES MORE MEMORY?
10 Million Strings (std::string) | |
String Length (bytes) | Memory (MB) |
---|---|
1 | 542.292 |
8 | 543.096 |
9 | 547.268 |
15 | 546.128 |
16 | 698.012 |
24 | 702.196 |
31 | 704.872 |
32 | 857.724 |
40 | 859.98 |
47 | 860.78 |
48 | 1016.716 |
56 | 1016.992 |
63 | 1017.848 |
64 | 1171.66 |
72 | 1173.552 |
144 | 1781.184 |
288 | 3065.48 |
10 Million Strings (CHAR arrays) | |
String Length (bytes) | Memory (MB) |
---|---|
1 | 391.624 |
8 | 390.84 |
16 | 390.592 |
17 | 390.912 |
23 | 391.28 |
24 | 391.368 |
25 | 548.064 |
26 | 547.996 |
28 | 548.932 |
31 | 543.996 |
32 | 547.601 |
40 | 546.872 |
41 | 704.116 |
44 | 704.344 |
47 | 703.808 |
48 | 704.104 |
49 | 704.384 |
56 | 705.616 |
63 | 705.692 |
64 | 860.584 |
72 | 861.088 |
144 | 1634.172 |
288 | 3048.912 |
- PLATFORM
- Name: Hercules
- Core width: 64 bits
- Motherboard: ASRock A770DE+
- CPU: AMD Athlon(tm) 64 X2 Dual Core Processor 6400+
- Size: 2GHz
- Capacity: 3200MHz
- Width: 64 bits
- Clock: 200MHz
- capabilities: x86-64 fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt rdtscp 3dnowext 3dnow rep_good nopl extd_apicid pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy cpufreq
- Configuration: Cores=2 Enabledcores=2
- L1 cache size: 256KiB
- L2 cache size: 2MiB
- System Memory Size: 4GiB
- DIMM DDR2 Synchronous 400 MHz (2.5 ns)
- Slot DIMM0 width: 64 bits
- System Clock: 400MHz (2.5ns)
- slot: DIMM1
- slot: DIMM1 size: 2GiB
- width: 64 bits
- clock: 400MHz (2.5ns)
- CPU to Nortbridge Speed: FSB 2600 MHz (5.2 GT/s)
- Bandwidth = Transfer Rate x Information Channel Width
- Northbridge: AMD 770
- Southbridge: AMD SB710
- DIMM DDR2 Synchronous 400 MHz (2.5 Nanoseconds)
- size: 2GiB
- width: 64 bits
- clock: 400MHz (2.5ns)
- Expansion Slot:
- 2 x PCI Express 2.0 x16 slots (green @ x16 mode, orange @ x4 mode)
- 1 x PCI Express 2.0 x1 slot
- 3 x PCI slots
- Supports ATITM CrossFireXTM