<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using BenchmarkDotNet.Tasks;

namespace BenchmarkDotNet
{
    public class Benchmark : IComparable<Benchmark>
    {
        public BenchmarkTarget Target { get; }
        public BenchmarkTask Task { get; }

        public string Caption => Target.Caption + "_" + Task.Caption;
        public string Description => $"{Target.Description} ({Task.Description})";
        public override string ToString() => Description;
        public IEnumerable<BenchmarkProperty> Properties => Target.Properties.Union(Task.Properties);

        public Benchmark(BenchmarkTarget target, BenchmarkTask task)
        {
            Target = target;
            Task = task;
        }

        public int CompareTo(Benchmark other)
        {
            return string.Compare(Task.Configuration.Caption + Target.Caption, other.Task.Configuration.Caption + other.Target.Caption, StringComparison.Ordinal);
        }
    }
}<commit_msg>Ensure the Description is used when sorting (if available)<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using BenchmarkDotNet.Tasks;

namespace BenchmarkDotNet
{
    public class Benchmark : IComparable<Benchmark>
    {
        public BenchmarkTarget Target { get; }
        public BenchmarkTask Task { get; }

        public string Caption => Target.Caption + "_" + Task.Caption;
        public string Description => $"{Target.Description} ({Task.Description})";
        public override string ToString() => Description;
        public IEnumerable<BenchmarkProperty> Properties => Target.Properties.Union(Task.Properties);

        public Benchmark(BenchmarkTarget target, BenchmarkTask task)
        {
            Target = target;
            Task = task;
        }

        public int CompareTo(Benchmark other)
        {
            // Use Description first as you explicitly have to include it, if it's empty fallback fo Configuration.Caption and Caption
            var thisText = string.IsNullOrWhiteSpace(Description) ? Task.Configuration.Caption + Target.Caption : Description;
            var otherText = string.IsNullOrWhiteSpace(other.Description) ? other.Task.Configuration.Caption + other.Target.Caption : other.Description;
            return string.Compare(thisText, otherText, StringComparison.Ordinal);
        }
    }
}
{'fraction_non_alphanumeric': 0.08818565400843882, 'fraction_numerical': 0.0, 'mean_word_length': 3.011844331641286, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '7529393', 'n_tokens_mistral': 619, 'n_tokens_neox': 597, 'n_words': 156}