Closed benaadams closed 3 years ago
I guess this is highly likely to hit cache as well since JSON names are repeated so much, eh? What kind of overall difference does this make?
@benaadams my concern with this PR is that it's pretty hard core and I'd just like to see that it's worth it outside of the microbenchmark of just snake casing strings. I'm pretty sure this is going to get called a ton in the real world and it would get a lot of cache hits because JSON has a lot of repeated strings, but it would be really nice to see an overall benchmark of using the client to send a bunch of events and seeing how changes like this and hopefully many more in the future impact the client overall. Thoughts?
@ejsmith sorry have rebuilding my machine so am re-setting up; should be able to provide more feedback after
I'm pretty sure this is going to get called a ton in the real world and it would get a lot of cache hits because JSON has a lot of repeated strings
So for a vanilla config every logged exception generates these 88 strings as part of JSON serilization (probably should also add tests to make sure its generating the same)
Type => type
Source => source
Date => date
Tags => tags
Message => message
Geo => geo
Value => value
Count => count
Data => data
ReferenceId => reference_id
Modules => modules
Message => message
Type => type
Code => code
Data => data
Inner => inner
StackTrace => stack_trace
TargetMethod => target_method
ModuleId => module_id
Name => name
Version => version
IsEntry => is_entry
CreatedDate => created_date
ModifiedDate => modified_date
Data => data
Message => message
Type => type
Code => code
Data => data
Inner => inner
StackTrace => stack_trace
TargetMethod => target_method
FileName => file_name
LineNumber => line_number
Column => column
IsSignatureTarget => is_signature_target
DeclaringNamespace => declaring_namespace
DeclaringType => declaring_type
Name => name
ModuleId => module_id
Data => data
GenericArguments => generic_arguments
Parameters => parameters
Name => name
Type => type
TypeNamespace => type_namespace
Data => data
GenericArguments => generic_arguments
IsSignatureTarget => is_signature_target
DeclaringNamespace => declaring_namespace
DeclaringType => declaring_type
Name => name
ModuleId => module_id
Data => data
GenericArguments => generic_arguments
Parameters => parameters
ProcessorCount => processor_count
TotalPhysicalMemory => total_physical_memory
AvailablePhysicalMemory => available_physical_memory
CommandLine => command_line
ProcessName => process_name
ProcessId => process_id
ProcessMemorySize => process_memory_size
ThreadName => thread_name
ThreadId => thread_id
Architecture => architecture
OSName => o_s_name
OSVersion => o_s_version
IpAddress => ip_address
MachineName => machine_name
InstallId => install_id
RuntimeVersion => runtime_version
Data => data
Identity => identity
Name => name
Data => data
UserAgent => user_agent
HttpMethod => http_method
IsSecure => is_secure
Host => host
Port => port
Path => path
Referrer => referrer
ClientIpAddress => client_ip_address
Cookies => cookies
PostData => post_data
QueryString => query_string
Data => data
Saying that; there's a bigger item I also want to add and it will use the same GC mechanism, so will add that first and come back with measurements
Hmm.. will get back to you, closing for now
Up to x3.5 faster snake casing for Json properties via caching; also dumps the cache at Gen2.
Move to
ConversionCached
approach; less allocations and much faster conversion (also incorporates theStringBuilderCached
for new strings)