Friday, December 14, 2018

Xamarin.Forms: Custom Fonts with Android, macOS and WPF

Below you'll see how to add TTF font to Xamarin.Forms 3.0+ app and apply it to UI. In CPDT  there was the issue of ensuring same look of texts across platforms. As it turned out, there's little overlap between standard font families. If you wanted monospace font, you could end up with  monospace on Android, Consolas on WPF and Courier on macOS. Thuogh the fonts are very different. Besides, on macOS you could have compatability issues with standard fonts: some High Sierra fonts are not available in El Capitan or Yosemite (and running app relying in missing font will crash it). The easiest way was to find a freely available font, download TTF, add it to the project and update Xamarin.Forms styles.

Monday, December 10, 2018

Samsung Galaxy S8: Exynos vs Snapdragon (Memory)

Here's the comparison of internal memory and RAM speed using CPDT:

As you can see, Exynos 8895 based Galaxy S8 is slightly stronger in sequential speeds (10-20%), faster in random reads (35%). Qualcomm Snapdragon 835 is faster is random writes (25 - you can notice the difference in how quickly Google Play Apps are installed)%)  25% better in RAM speed.

Benchmark results at CPDT web page.

Friday, December 7, 2018

Android Full-disk Encryption - Performance Penalty Measured

Below you can see 3 charts showing percentage difference in average throughput before and after enabling encryption. Values are given for 4 tests of internal memory (SW - Sequential Write, SR - Sequential Read, RW - Random Write 4KB block, RR - Random Read 4KB block). In other words the charts show how much faster an unencrypted device is.
  • For older and cheaper Mi Max there's a significant drop in storage performance (2x-6x - very similar results to Nexus 6, see bellow).
  • Flagship Mi5 has barely visible slowdown with speed differences fluctuating around 5%.
  • Fresh 2018 Mi8 SE has significant drop of random reads (to 75% of non-encrypted speed) and yet show decent speeds at above 9MB/s.
  • In all 3 cases the most noticeable drop is at random reads.
  • Judging by Mi5 and Mi8 SE one can say that modern Qualcomm hardware provides decent encryption acceleration with no significant slowdown of permanent storage.
  • Though judging by mid-range Mi Max one might expect poor encryption performance in budget phones.
  • It'd be great to have a look at Mediatek and Samsung numbers. There's a suspiciously low performance of Random writes in Exynos versions of Galaxy S8 and Galaxy S9.

Thursday, August 2, 2018

Azure VM SSD Performance is 2.5x Slower than Expected

... and random write speeds are way below what's expected form SSD.

NOTE: the speeds were measured with all kinds of caching and buffering disabled. See updates below for clarifications.

VM Size: Standard DS11 v2 Promo (2 vcpus, 14 GB memory)
Disk attached to the VM is Premium SSD with 150 MB/s max speed:

Sunday, July 29, 2018

2018 15" MacBook Pro SSD Benchmark - macOS, Bootcamp and Windows on VMWare Fusion

Hardware:

  • 2018 15 inch MacBook Pro, 2.6 GHz Intel Core i7,  Radeon 560X, 16 GB DDR4 RAM, 512 GB SSD

Software:

  • macOS High Sierra 10.13.6 (with July update addressing throttling issue), APFS + encryption
  • Bootcamp, Windows 10 Pro x64 Fall Creators Update, NTFS
  • VMWare Fusion 10.1.1, Windows 10 Pro x86 guest OS, NTFS

Friday, July 27, 2018

Non-cached/non-buffered File Operations (System.IO.FileSteam) with .NET Core on Windows and Mac - Creating Cross-platform Disk Benchmark App

If you have the question of executing disc reads/writes directly against the device and avoid file cache of the OS you're welcome to continue reading this post.

Intro

Assume you're creating a disk benchmark app you want to execute on Windows and macOS (and might be any other platform) and in your .NET Core project come up with a solution similar to the below C# code snippet:

var sw = new Stopwatch();
var file = new FileStream("C:\\testfile.dat", FileMode.CreateNew);
var buffer = new byte[1024 * 1024 * 1024];
var rand = new Random();
rand.NextBytes(buffer);

sw.Restart();
file.Write(buffer, 0, blockSize);
file.Flush();
sw.Stop();

- you create a file a get an instance of FileStream, write a randomized byte array to it and measure the time it took to complete the write.