Skip to content

Commit 8cae63a

Browse files
committed
graph: Update the comments in stress example about measurements
1 parent 6f4a49f commit 8cae63a

File tree

1 file changed

+18
-21
lines changed

1 file changed

+18
-21
lines changed

graph/examples/stress.rs

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -500,35 +500,32 @@ pub fn main() {
500500
// different types of cache entries. Uncomment one of the 'let mut cacheable'
501501
// lines
502502
if opt.template == "vec" {
503-
// With Vec<usize> we stay within between opt.cache_size and 3*opt.cache_size
504-
// Larger heap factors for very small arrays
503+
// The weight of Vec<usize> is precise. The additional memory that
504+
// the cache uses must be solely due to the memory for the cache
505+
// itself
506+
//
505507
// obj_size | heap factor
506-
// 10 | 4.02
507-
// 20 | 2.39
508-
// 30 | 2.40
509-
// 50 | 1.76
510-
// 100 | 1.38
511-
// 1000 | 1.05
508+
// 10 | 2.5
509+
// 20 | 1.9
510+
// 30 | 1.8
511+
// 50 | 1.3
512+
// 100 | 1.3
513+
// 1000 | 1.1
512514
stress::<Vec<usize>>(&opt);
513515
} else if opt.template == "hashmap" {
514-
// Cache HashMap<String, String>
515-
// The heap factor ranges between 2.23 (size 3) and 1.06 (size 100)
516-
//let mut cacheable: Cacheable<HashMap<String, String>> = Cacheable::new(opt.obj_size);
516+
// The heap factor ranges between 1.9 (size 3) and 1.06 (size 100)
517517
stress::<HashMap<String, String>>(&opt);
518518
} else if opt.template == "valuemap" {
519519
// Cache BTreeMap<String, Value>
520520
// obj_size | heap factor
521-
// 3 | 16.51
522-
// 5 | 12.07
523-
// 10 | 4.64
524-
// 50 | 3.07
525-
// 100 | 2.94
521+
// 3 | 1.3
522+
// 5 | 1.5
523+
// 10 | 1.5
524+
// 50 | 1.2
525+
// 100 | 0.9
526526
//
527-
// The above is for a weight calculation that does not take the
528-
// allocated, unused space in the BTree into account. With a guess
529-
// at those, the above heap factors range from 1.14 to 0.88, with the
530-
// exception of obj_size 0 where we get a factor of 2.88, but that
531-
// must be caused by some other effect
527+
// For small maps (say, up to about 20 entries), the weight is an
528+
// accurate estimation of the map's allocation
532529
stress::<ValueMap>(&opt);
533530
} else if opt.template == "string" {
534531
stress::<String>(&opt);

0 commit comments

Comments
 (0)