Skip to content

Feed aggregator

Understanding ASP.Net MVC Using Real World Example

C-Sharpcorner - Latest Articles - Sat, 01/31/2015 - 08:00
This article covers the overview of ASP.NET's MVC framework with real world examples for absolute beginners and intermediates.
Categories: Communities

Fibonacci Spiral App For Windows Phone

C-Sharpcorner - Latest Articles - Sat, 01/31/2015 - 08:00
In this article you will learn how to create Fibonacci Spiral App For Windows Phone.
Categories: Communities

Identity Column in SQL Server

C-Sharpcorner - Latest Articles - Sat, 01/31/2015 - 08:00
This article explains how to supply explicit values for an identity column and how to reset it.
Categories: Communities

Introduction to HTML

C-Sharpcorner - Latest Articles - Sat, 01/31/2015 - 08:00
This is an article for you introducing HTML.
Categories: Communities

Hoisting in JavaScript: Day 9

C-Sharpcorner - Latest Articles - Sat, 01/31/2015 - 08:00
In this article you will learn about Hoisting in JavaScript.
Categories: Communities

Power BI Preview and SQL Server Analysis Services

Yesterday we announced exciting news for Power BI – a cloud-based business analytics service (software-as-a-service) for non-technical business users.  The preview introduces a number of new Power BI capabilities including dashboards, new visualizations, support for popular software-as-a-service applications, a native iPad app and live “hybrid” connectivity to on-premises SQL Server Analysis Services tabular models. With just a browser – any browser – or a Power BI mobile app, customers can keep a pulse on their business via live operational dashboards. They can explore their business data, through interactive visual reports, and enrich it with additional data sources.

How does it work with SQL Server?
To interact with SQL Server data in Power BI, connect to SSAS server via the ‘Get Data’ menu. From there, you can connect to a model and run queries for visualizations based on that model. Before your users can connect to an SSAS model, an administrator must configure a Power BI Analysis Services connector.

 

To learn more about the Power BI preview, watch as Michael Tejedor gives Jeremy Chapman from Office Mechanics a first look at what’s new.

Categories: Companies

ALM Links–January 30, 2015

ALM Rocks! - Fri, 01/30/2015 - 15:53

Jeff Bramwell on Visual Studio 2015 CTP 5: Jeff provides a quick overview of what’s new in VS 2015 CTP 5. I’m especially interested in the new diagnostic tools.

NorthWest Cadence on Configuration Management and Desired State Configuration: Bryon has a discussion around configuration drift and PowerShell DSC. For us science geeks, Bryon breaks out the model of the atom as part of his discussion.

Rene van Osnabrugge on Insert an inline image into a Work Item with the TFS API: Rene shows how to add an image directly to a work item using the TFS API.  This will be helpful if you have to build your own custom migration tools to migrate to TFS, and have to deal with inline images.

Martin Hinshelwood on Why should I use Visual Studio ALM: Martin provides some questions and answers for you to consider when looking at changing your tooling.

Categories: Companies

Excerpts from the RavenDB Performance team report: Optimizing Compare, Don’t you shake that branch at me!

Ayende @ Rahien - Fri, 01/30/2015 - 11:00

Note, this post was written by Federico. In the previous post after inspecting the decompiled source using ILSpy  we were able to uncover potential things we could do.

By now we already squeeze almost all the obvious inefficiencies that we had uncovered through static analysis of the decompiled code, so now we will need another strategy. For that we need to analyze the behavior in runtime in the average case. We did something like that when in this post when we made an example using a 16 bytes compare with equal arrays.

To achieve that analysis live we will need to somehow know the size of the typical memory block while running the test under a line-by-line profiler run. We built a modified version of the code that stored the size of the memory chunk to compare and then we built an histogram with that (that’s why exact replicability matters). From our workload the histogram showed that there were a couple of clusters for the length of the memory to be compared. The first cluster was near 0 bytes but not exactly 0. The other cluster was centered around 12 bytes, which makes sense as the keys of the documents were around 11 bytes. This gave us a very interesting insight. Armed with that knowledge we made our first statistical based optimization.

You can notice the if statement at the start of the method, which is a pretty standard bounding condition. If the memory blocks are empty, therefore they are equal. In a normal environment such check is so simple that nobody would bother, but in our case when we are measuring the runtime in the nanoseconds, 3 extra instructions and a potential branch-miss do count.

That code looks like this:

image

That means that not only I am making the check, we are also forcing a short-jump every single time it happens. But our histogram also tells us that memory blocks of 0 size almost never happen. So we are paying with 3 instructions and a branch for something that almost never happen. But we also knew that there was a cluster near the 0 that we could exploit. The problem is that we would be paying 3 cycles (1 nanosecond in our idealized processor) per branch. As our average is 97.5 nanoseconds, we have 1% improvement in almost any call (except the statistically unlikely case) if we are able to get rid of it.

Resistance is futile, that branch needs to go. Smile

In C and Assembler and almost any low level architecture like GPUs, there are 2 common approaches to optimize this kind of scenarios.

  • The ostrich method. (Hide your head in the sand and pray it just work).
  • Use a lookup table.

The first is simple, if you don’t check and the algorithm can deal with the condition in the body, zero instructions always beats more than zero instruction (this case is a corner case anyways, no damage is dealt). This one is usually used in massive parallel computing where the cost of instructions is negligible while memory access is not. But it has its uses in more traditional superscalar and branch-predicting architectures (you just don’t have so much instructions budget to burn).

The second is more involved. You need to be able to “index” somehow the input and pay with less instructions than do the actual branches (at a minimum of 1 nanosecond each aka 3 instructions of our idealized processor). Then create a branch table and jump to the appropriate index which itself will jump to the proper code block using just 2 instructions.

Note: Branch tables are very well explained at http://en.wikipedia.org/wiki/Branch_table. If you made it that far you should read it, don’t worry I will wait.

As the key take away if your algorithm have a sequence of 0..n, you are in the best world, you already have your index. Which we did Smile.

I know what you are thinking: Will the C# JIT compiler be smart enough to convert such a pattern into a branch table?

The short answer is yes, if we give it a bit of help. The if-then-elseif pattern won’t cut it, but what about switch-case?

The compiler will create a switch opcode, in short our branch table, if our values are small and contiguous.

Therefore that is what we did. The impact? Big, but this is just starting. Here is what this looks like in our code:

image

I’ll talk about the details of branch tables in C# more in the next post, but I didn’t want to leave you hanging too much.

Categories: Blogs

WindowsPhone 8.0: Change Default Emulator Skin Border With Skin Switcher, Beginners Tip

C-Sharpcorner - Latest Articles - Fri, 01/30/2015 - 08:00
This article explains how to change the default Emulator skin border using the WP8 Emulator Skin Switcher.
Categories: Communities

Connecting WCF Local Host With Windows Phone Emulator

C-Sharpcorner - Latest Articles - Fri, 01/30/2015 - 08:00
In this article you will learn how to connect a WCF Local Host with the Windows Phone Emulator.
Categories: Communities

Method Overriding in C#

C-Sharpcorner - Latest Articles - Fri, 01/30/2015 - 08:00
In this article, we will learn about method overriding in C#.
Categories: Communities

Using XAML WrapPanel in WPF

C-Sharpcorner - Latest Articles - Fri, 01/30/2015 - 08:00
This tutorial shows how to use a XAML WrapPanel in WPF,
Categories: Communities

Introduction to Microsoft Azure: Part 3 (Data Service)

C-Sharpcorner - Latest Articles - Fri, 01/30/2015 - 08:00
In this article, we have come across through with the fundamentals of SQL Azure as well as stated the importance of SQL Azure cloud features that replaced SQL Data Services.
Categories: Communities

Interrupt Testing

C-Sharpcorner - Latest Articles - Fri, 01/30/2015 - 08:00
In this article you will learn about Interrupt Testing.
Categories: Communities

Receiving a Result From an Activity Using Android Studio 1.0

C-Sharpcorner - Latest Articles - Fri, 01/30/2015 - 08:00
This article illustrates how to receive a result from an activity and start an activity from another application.
Categories: Communities

Generic Binary Search Tree With Keyed Values Using C#

C-Sharpcorner - Latest Articles - Fri, 01/30/2015 - 08:00
A Binary Search Tree (BST) is a binary tree (max. 2 childs per node) with every node a key and associated value.
Categories: Communities

Connecting With Visual Studio 2013 Team Foundation Server

C-Sharpcorner - Latest Articles - Fri, 01/30/2015 - 08:00
In this article you will learn how to connect to Visual Studio 2013 Team Foundation Server.
Categories: Communities

YII Framework Installation on XAMPP in PHP

C-Sharpcorner - Latest Articles - Fri, 01/30/2015 - 08:00
In this article you will learn YII Framework Installation on XAMPP in PHP
Categories: Communities

Use Visual Studio 2013 With Github

C-Sharpcorner - Latest Articles - Fri, 01/30/2015 - 08:00
In this article you will learn how to use Visual Studio 2013 with Github.
Categories: Communities

WCF Service to Insert and Retrieve Data From SQL Server 2012 Express

C-Sharpcorner - Latest Articles - Fri, 01/30/2015 - 08:00
In this article you will learn how to create a WCF service for Insertion and Retrieval of data.
Categories: Communities