Skip to content

Commit

Permalink
Change all MudLinks to Links.
Browse files Browse the repository at this point in the history
  • Loading branch information
V0ldek committed Oct 16, 2023
1 parent f5cb370 commit e208758
Show file tree
Hide file tree
Showing 92 changed files with 258 additions and 191 deletions.
2 changes: 1 addition & 1 deletion src/Sorcery/App.razor
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</MudText>
<MudText GutterBottom="true">
If you're sure this page is ought to be, but it isn't, I'd appreciate if you could file an issue on
<MudLink Href="@GitHub.Sorcery">GitHub</MudLink> telling me how you got here.
<Link Href="@GitHub.Sorcery">GitHub</Link> telling me how you got here.
</MudText>
<MudText>
Other than that, enjoy this cute picture of a rabbit.
Expand Down
14 changes: 14 additions & 0 deletions src/Sorcery/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Licensed under MIT, copyright Mateusz Gienieczko, all rights reserved.

// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.

using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage(
"Naming", "CA1716:Identifiers should not match keywords",
Justification = "We will not be consuming Sorcery from VB...",
Scope = "namespace",
Target = "~N:Sorcery.Shared")]
27 changes: 17 additions & 10 deletions src/Sorcery/Pages/AboutMe.razor
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,36 @@
<MudItem xs="6" sm="3" Class="ma-auto">
<MudAvatarGroup MaxSize="Size.Large" Outlined="true" OutlineColor="Color.Primary">
<MudSpacer />
<MudAvatar Image="/img/v0ldek.webp" Alt="my gravatar" Size="Size.Large"></MudAvatar>
<MudAvatar Image="/img/me.webp" Alt="my actual photo" Size="Size.Large" Variant="Variant.Filled"></MudAvatar>
<MudAvatar Size="Size.Large">
<MudImage Alt="my gravatar" Src="/img/v0ldek.webp"></MudImage>
</MudAvatar>
<MudAvatar Size="Size.Large" Variant="Variant.Filled">
<MudImage Alt="my actual photo" Src="/img/me.webp"></MudImage>
</MudAvatar>
</MudAvatarGroup>
</MudItem>
</MudGrid>
<MudDivider Class="my-6" DividerType="DividerType.FullWidth" Vertical="false"/>

<article id="about-me-article">
<MudText GutterBottom="true">I'm Mateusz Gienieczko, on most sites and apps under the nickname of V0ldek.</MudText>
<Paragraph>I'm Mateusz Gienieczko, on most sites and apps under the nickname of V0ldek.</Paragraph>

<MudText GutterBottom="true">
<Paragraph>
I'm a programmer and a computer scientist, by education, choice, and heart.
I have strong opinions about a lot of things, with programming languages probably leading the race.
I hate everything that starts with "Java", I love C#, and I think Rust is genius. I am the sole author
of everything on this page, unless explicitly stated otherwise.
</MudText>
of everything on this page, unless explicitly stated otherwise. I now explicitly state
that the comments on this site are not mine, but I do moderate them.
</Paragraph>

<MudText GutterBottom="true">
I'm currently working in Microsoft Ireland in the Identity team.
Graduated with a Master's in Computer Science at the University of Warsaw,
and taught a course on C#.NET, available on this page.
Academically I'm interested in automata, theory of computation,
and formal logic. You can find my CV <MudLink Href="/cv" Target="_blank">here</MudLink>.
and formal logic. You can find my CV <Link Href="/cv" Target="_blank">here</Link>.
My Master's was extended and published at ASPLOS'24 as
<Link Href="/img/rsonpath-paper.pdf">Supporting Descendants in SIMD-Accelerated JSONPath</Link>.
</MudText>

<MudText GutterBottom="true">
Expand Down Expand Up @@ -69,7 +76,7 @@
<MudText Typo="Typo.caption">
Thesis: Product Scanner &ndash;
an image reconstruction app for generating fully textured 3D models of products
with an Azure Kinect camera. Unfortunately proprietary, IP went to <MudLink Href="https://aifi.com/" Typo="Typo.caption">AiFi</MudLink>.
with an Azure Kinect camera. Unfortunately proprietary, IP went to <Link Href="https://aifi.com/" Typo="Typo.caption">AiFi</Link>.
</MudText>
</MudPaper>
</ItemContent>
Expand All @@ -83,7 +90,7 @@
<MudText Color="Color.Primary" Typo="Typo.h6" GutterBottom="true">Master's in Computer Science</MudText>
<MudText Typo="Typo.caption">
Thesis: rapid execution of queries on JSON documents with SIMD.
Available <MudLink Href="/masters" Typo="Typo.caption">here</MudLink>.
Available <Link Href="/masters" Typo="Typo.caption">here</Link>.
</MudText>
</MudPaper>
</ItemContent>
Expand Down Expand Up @@ -111,7 +118,7 @@
</MudTimelineItem>
<MudTimelineItem>
<ItemOpposite>
<MudText Color="Color.Primary" Typo="Typo.h6">2036 (planned)</MudText>
<MudText Color="Color.Primary" Typo="Typo.h6">@(DateTime.Now.Year + 13) (planned)</MudText>
</ItemOpposite>
<ItemContent>
<MudText Typo="Typo.caption">
Expand Down
58 changes: 34 additions & 24 deletions src/Sorcery/Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,52 @@

<MudContainer MaxWidth="MaxWidth.Large">
<MudPaper Height="100%" Width="100%" Class="pa-sm-16 pa-4 my-4">
<MudText Typo="Typo.h1" Class="mx-auto">Greetings!</MudText>
<MudDivider Class="my-6" DividerType="DividerType.FullWidth" Vertical="false"/>
<MudText GutterBottom="true">
<Header1>Greetings!</Header1>
<Paragraph>
I'm Mateusz Gienieczko, a.k.a. V0ldek on all the platforms that allow you to put your nickname in.
I'm a programmer and a streamer. You can learn more about me at <MudLink Href="/about">About me</MudLink>.
</MudText>
I'm a programmer, currently at Microsoft Identity, and I dabble in open-source in the meantime.
You can learn more about me at <Link Href="/about">About me</Link>.
</Paragraph>

<MudText>
I write a blog at <MudLink Href="/sourcery">Sourcery</MudLink>, here's the latest post:
</MudText>
<Paragraph>
I write a blog at <Link Href="/sourcery">Sourcery</Link>, here's the latest post:
</Paragraph>

<div class="ma-4">
<BlogPostCard Post="BlogBook.Posts.First()" />
</div>

<MudText>
I have a course on C# starting from the very basics &ndash; check out <MudLink Href="/teaching">Teaching</MudLink>.
</MudText>
<Paragraph>
I have a course on C# starting from the very basics &ndash; check out <Link Href="/teaching">Teaching</Link>.
</Paragraph>

<MudText Typo="Typo.h2" Class="mx-auto my-6">About this page</MudText>
<MudText GutterBottom="true">
<Header2>About this page</Header2>
<Paragraph>
First of all, this page is fully open-source. If there are any issues that you see, or room
for improvement and making it more accessible for you, please, file an issue on <MudLink Href="@GitHub.Sorcery">GitHub</MudLink>.
</MudText>
<MudText GutterBottom="true">
It is powered by <MudLink Href="https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor">Blazor</MudLink>
and written in C#, with the help of <MudLink Href="https://mudblazor.com/">MudBlazor</MudLink> components.
for improvement and making it more accessible for you, please, file an issue on <Link Href="@GitHub.Sorcery">GitHub</Link>.
</Paragraph>
<Paragraph>
It is powered by <Link Href="https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor">Blazor</Link>
and written in C#, with the help of <Link Href="https://mudblazor.com/">MudBlazor</Link> components.
It contains as little JavaScript as possible while still being presentable, which means it uses the
<MudLink Href="https://katex.org/">KaTeX</MudLink>, <MudLink Href="https://prismjs.com/">Prism</MudLink>,
and the <MudLink Href="https://asciinema.org/">Asciinema</MudLink> player libraries.
</MudText>
<MudText>
All resources are statically hosted, literally no external sites are called from here.
<Link Href="https://katex.org/">KaTeX</Link> for pretty math,
<Link Href="https://prismjs.com/">Prism</Link> for syntax highlighting,
and the <Link Href="https://asciinema.org/">Asciinema</Link> player libraries for animated terminal snippets.
</Paragraph>
<Header2>Privacy</Header2>
<Paragraph>
All resources are statically hosted with the exception of comments;
the only external calls that this site makes are to the comment service.
There is no trackers and I do not store any personal information.
I know, complete avant-garde. I wish "Web 3.0" was this instead of whatever it's
being sold as right now.
</MudText>
</Paragraph>
<Paragraph>
Comments are powered by <Link Href="https://giscus.app/">giscuss</Link> and hosted on
<Link Href="https://github.com/V0ldek/Sorcery/discussions">GitHub Discussions</Link>;
you need a GitHub account to post a comment, and all the comment data is managed by GitHub
according to <Link Href="https://docs.github.com/en/site-policy/privacy-policies/github-privacy-statement">their privacy policy</Link>.
If you wish your comments disappeared from this site simply delete them from the relevant GitHub Discussion.
</Paragraph>
</MudPaper>
</MudContainer>
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<Paragraph GutterBottom="false">
Enter the world of SIMD. This series will introduce the concept from first principles,
starting with simple concepts at a high-level and then gradually getting us closer to the metal.
starting with simple techniques at a high-level and then gradually getting us closer to the metal.
Part 1 starts with good old C# code, without any magic tricks. All the code for this part can be found
<Link Href="https://github.com/V0ldek/Sorcery/tree/master/src/BlogPostCode/SimdCheatCodesForFreePerformance">on my GitHub</Link>.
</Paragraph>
Expand Down Expand Up @@ -512,22 +512,47 @@ ref int Foo()
{
int x = 0;
return ref x;
// ^
// error CS8168: Cannot return local 'x' by reference because it is not a ref local
}
")" />
</Paragraph>
<Paragraph>
Under the hood a <Code>{ReadOnly}Span&lt;T&gt;</Code> contains a <Code>ref</Code> to the first
element, and the length of the entire span. As you might expect, a <Code>ref</Code> is simply a pointer,
and we can therefore manipulate it using some special unsafe methods. For example, if we have a span we can get
the underlying <Code>ref</Code>, and then offset it:
<CodeBlock Code="@(@"
var tab = new int[] { 1, 2, 3, 4 };
ReadOnlySpan<int> span = tab;

ref int elem0 = ref MemoryMarshal.GetReference(span);
ref int elem1 = ref Unsafe.Add(ref elem0, 1);
ref int elem3 = ref Unsafe.Add(ref elem0, 3);

Console.WriteLine(elem0);
Console.WriteLine(elem1);
Console.WriteLine(elem3);
")" />
this prints <Code>1 2 4</Code>. <Footnote>
See this in action in <Link Href="https://sharplab.io/#gist:32320654a81f15054834864986b82c69">SharpLab</Link>.
</Footnote><Footnote>
The <Link Href="https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.memorymarshal?view=net-7.0">
<Code>MemoryMarshal</Code>
</Link> class exists specifically to help translating between a <Code>{ReadOnly}Span</Code> and its contiguous slice memory representation.
The <Link Href="https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.unsafe.add?view=net-7.0#system-runtime-compilerservices-unsafe-add-1">
<Code>Unsafe.Add</Code>
</Link> function is unsafe because it does not bounds check the offset and therefore can violate memory safety. Note that <Code>GetReference</Code> is also "unsafe"
in some sense, as it gives a <Code>ref</Code> into a potentially <Code>ReadOnlySpan</Code>, which allows mutating the contents. C# has barely any immutability guarantees!
</Footnote>
</Paragraph>
</section>
<Header4>The Code</Header4>
<section>
<Paragraph>
Okay, let's actually write and run that.
First we will take our <Code>ReadOnlySpan</Code>s and ask a helper class
<Footnote>
<Link Href="https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.memorymarshal?view=net-7.0">
<Code>MemoryMarshal</Code>
</Link>,
which exists specifically to help translating between a <Code>ReadOnlySpan</Code> and its contiguous slice memory representation.
</Footnote>
to give us a <Code>ref</Code> to the first byte, which can be loaded into a <Code>Vector128&lt;byte&gt;</Code>.
First we will take our <Code>ReadOnlySpan</Code>s and get a <Code>ref</Code> to the first byte, which can be loaded into a <Code>Vector128&lt;byte&gt;</Code>.
We could go full-on into unsafe mode and use raw pointers, but that requires pinning and just feels less csharpy.
We will use the <Code>cmpeq</Code> map and the <Code>movemask</Code> projection to get a bitmask where set bits signify elements
that are the same.
<Footnote>
Expand Down Expand Up @@ -599,8 +624,8 @@ private int? Simd128Portable(ReadOnlySpan<byte> sensor1, ReadOnlySpan<byte> sens
}
")" />
<Paragraph>
Whew. The reference handling is a bit scary with all the "unsafe", but the rest should be
understandable with our walkthrough. You can play around with the code from
Whew. The reference handling is a bit scary with all the "unsafe", but the rest should feel familiar.
You can play around with the code from
<Link Href="https://github.com/V0ldek/Sorcery/tree/master/src/BlogPostCode/SimdCheatCodesForFreePerformance">my GitHub</Link>
or on this <Link Href="https://sharplab.io/#gist:03ef2822ab66d8c680703ea870526dec">SharpLab demo</Link>.
So, it's a bit harder to code in this paradigm, but are the performance gains
Expand Down Expand Up @@ -655,7 +680,7 @@ private int? Simd128Portable(ReadOnlySpan<byte> sensor1, ReadOnlySpan<byte> sens
</MudSimpleTable>
<Paragraph>
Changing nothing about the fundamental algorithm we made it <Highlight>$16\times$ faster</Highlight>
just by switching to SIMD! And apart from a few relatively uncommon ref-offset operations that's
just by switching to SIMD! And apart from a few relatively uncommon <Code>ref</Code>-offset operations that's
just plain C# code, the JIT does the heavy lifting for us.
</Paragraph>
<Paragraph>
Expand Down
5 changes: 3 additions & 2 deletions src/Sorcery/Pages/Sourcery/Sourcery.razor
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@

<MudContainer MaxWidth="MaxWidth.Large">
<MudPaper Height="100%" Width="100%" Class="pa-sm-16 pa-4 my-4">
<MudText Typo="Typo.h1" Class="mx-auto">Sourcery</MudText>
<MudDivider Class="my-6" DividerType="DividerType.FullWidth" Vertical="false" />
<Header1>Sourcery</Header1>
<Paragraph>
This is my blog, where I muse about cool coding problems, performance, programming languages,
and pretty much whatever programming related. The only overarching theme is that coding is modern-day
sorcery and I refuse to use my magic abilities responsibly.
</Paragraph>

<Header2>Latest posts</Header2>

@foreach (var post in BlogBook.Posts.Take(3))
{
<BlogPostCard Post="@post" class="my-2"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ extends [System.Private.CoreLib]System.Object
code across your organisation without making it open-source.
</MudText>
<MudText GutterBottom="true">
.NET packages follow <MudLink Href="https://semver.org/">Semantic Versioning (SemVer)</MudLink>, which makes updates rather painless.
.NET packages follow <Link Href="https://semver.org/">Semantic Versioning (SemVer)</Link>, which makes updates rather painless.
Of course, it's not really a statically enforcible standard, so some packages might violate that, but that's semver for you.
Turning your library into a package is actually pretty easy and simply requires the developer to associate some metadata with the
binaries that they create.
Expand Down
Loading

0 comments on commit e208758

Please sign in to comment.