<commit_before><commit_msg>- add HashMap vs LinkedHashMap comparison<commit_after>package com.github.abrasha;

import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.infra.Blackhole;

import java.util.*;
import java.util.concurrent.TimeUnit;

// Run complete.
//
// Benchmark                             Mode  Cnt    Score    Error  Units
// HashMapVSLinkedHashMap.hashMap        avgt    9  104.324 ± 10.539  ns/op
// HashMapVSLinkedHashMap.linkedHashMap  avgt    9  170.261 ± 45.108  ns/op

@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public class HashMapVSLinkedHashMap {
    
    @Benchmark
    public void hashMap(Blackhole bh) throws CloneNotSupportedException {
        
        Map<Integer, String> map = new HashMap<>();
        
        map.put(0, "zero");
        map.put(1, "one");
        map.put(2, "two");
        map.put(3, "three");
        map.put(4, "four");
        map.put(5, "five");
        map.put(6, "six");
        map.put(7, "seven");
        map.put(8, "eight");
        map.put(9, "nine");
        
        bh.consume(map);
        
    }
    
    @Benchmark
    public void linkedHashMap(Blackhole bh) {
    
        Map<Integer, String> map = new LinkedHashMap<>();
    
        map.put(0, "zero");
        map.put(1, "one");
        map.put(2, "two");
        map.put(3, "three");
        map.put(4, "four");
        map.put(5, "five");
        map.put(6, "six");
        map.put(7, "seven");
        map.put(8, "eight");
        map.put(9, "nine");
    
        bh.consume(map);
        
    }
    
}
{'fraction_non_alphanumeric': 0.15079872204472844, 'fraction_numerical': 0.028115015974440896, 'mean_word_length': 1.9715370018975331, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5998649', 'n_tokens_mistral': 557, 'n_tokens_neox': 542, 'n_words': 106}