@@ -500,35 +500,32 @@ pub fn main() {
500
500
// different types of cache entries. Uncomment one of the 'let mut cacheable'
501
501
// lines
502
502
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
+ //
505
507
// 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
512
514
stress :: < Vec < usize > > ( & opt) ;
513
515
} 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)
517
517
stress :: < HashMap < String , String > > ( & opt) ;
518
518
} else if opt. template == "valuemap" {
519
519
// Cache BTreeMap<String, Value>
520
520
// 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
526
526
//
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
532
529
stress :: < ValueMap > ( & opt) ;
533
530
} else if opt. template == "string" {
534
531
stress :: < String > ( & opt) ;
0 commit comments