Skip to content

Instantly share code, notes, and snippets.

View layomia's full-sized avatar

Layomi Akinrinade layomia

View GitHub Profile

Converters

  • JsonDefaultArrayConverter<>
    • Single-dimentional arrays
  • JsonListOfTConverter<>
    • List
    • Types deriving from List
  • JsonDictionaryOfStringTValueConverter<,>
    • Dictionary<string, TValue>
  • Types deriving from Dictionary
private static void HandleStartObject(JsonSerializerOptions options, ref ReadStack state)
{
Debug.Assert(!state.Current.IsProcessingDictionary());
if (state.Current.IsProcessingEnumerable())
{
// A nested object within an enumerable.
Type objType = state.Current.GetElementType();
state.Push();
state.Current.Initialize(objType, options);
private static void HandleStartDictionary(JsonSerializerOptions options, ref ReadStack state)
{
Debug.Assert(!state.Current.IsProcessingEnumerable());
JsonPropertyInfo jsonPropertyInfo = state.Current.JsonPropertyInfo;
if (jsonPropertyInfo == null)
{
jsonPropertyInfo = state.Current.JsonClassInfo.CreateRootProperty(options);
}
@layomia
layomia / ImmutableDictPerf.md
Last active May 31, 2019 18:00
Immutable Dict Perf

Some performance notes.

TLDR

  • There's no significant performance impact on hot path (de)serialization i.e. primitives, objects, and enumerables.
  • There's a little (~4.6% avg.) regression for deserializing Dictionary, IDictionary, and IReadOnlyDictionary. This is due to some necessary if-checks introduced in shared code-paths between non-immutable dicts and immutable dicts. Splitting their code-paths entirely might mitigate this, but is beyond the scope for preview 6. This will be targeted in preview 7.
  • We might be able to improve the performance of (de)serializing ImmutableDicitonary, IImmutableDictionary, and ImmutableSortedDictionay by using IL emit to generate high performance CreateRange methods.

Hot-path deserialization and serialization use cases (Primitives, enumerables, objects)

These benchmarks live in the perf repo.

@layomia
layomia / The Technical Interview Cheat Sheet.md
Created February 6, 2016 19:46 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.