<commit_before>﻿using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Net.Http;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using Unosquare.Tubular.ObjectModel;

namespace Unosquare.Tubular
{
    /// <summary>
    /// Extensions methods
    /// </summary>
    public static class Extensions
    {
        private static readonly Regex TimezoneOffset = new Regex(@"timezoneOffset=(\d[^&]*)");

        private static readonly object SyncRoot = new object();

        private static readonly ConcurrentDictionary<Type, Dictionary<string, PropertyInfo>> TypePropertyCache = new ConcurrentDictionary<Type, Dictionary<string, PropertyInfo>>();

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        private static Dictionary<string, PropertyInfo> ExtractProperties(Type t)
        {
            return TypePropertyCache.GetOrAdd(t, GetTypeProperties);
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        private static Dictionary<string, PropertyInfo> GetTypeProperties(Type t)
        {
            return t.GetProperties()
                    .Where(p => Common.PrimitiveTypes.Contains(p.PropertyType) && p.CanRead)
                    .ToDictionary(k => k.Name, v => v);
        }
<commit_msg>Removing the lock object<commit_after>﻿using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Net.Http;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using Unosquare.Tubular.ObjectModel;

namespace Unosquare.Tubular
{
    /// <summary>
    /// Extensions methods
    /// </summary>
    public static class Extensions
    {
        private static readonly Regex TimezoneOffset = new Regex(@"timezoneOffset=(\d[^&]*)");

        private static readonly ConcurrentDictionary<Type, Dictionary<string, PropertyInfo>> TypePropertyCache = new ConcurrentDictionary<Type, Dictionary<string, PropertyInfo>>();

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        private static Dictionary<string, PropertyInfo> ExtractProperties(Type t)
        {
            return TypePropertyCache.GetOrAdd(t, GetTypeProperties);
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        private static Dictionary<string, PropertyInfo> GetTypeProperties(Type t)
        {
            return t.GetProperties()
                    .Where(p => Common.PrimitiveTypes.Contains(p.PropertyType) && p.CanRead)
                    .ToDictionary(k => k.Name, v => v);
        }

{'fraction_non_alphanumeric': 0.10042735042735043, 'fraction_numerical': 0.0, 'mean_word_length': 3.4800637958532694, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 25, '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': '5876264', 'n_tokens_mistral': 749, 'n_tokens_neox': 723, 'n_words': 166}