Friday, April 30, 2010

How much faster is CodeRush ?


Recently DevExpress released a video which compared the rename functionality in CodeRush to that of in of it’s competitor products.

There then followed some discussion on Twitter, about how valid the tests were.

Questions were raised like “Why would anyone want undo like that ?” and comments were made like “He probably used a pre-release version of ‘Brand X’ productivity tool. They’re always slower than the RTM versions”.

These are potentially fair points. Lets see if we can address them.

“Why would anyone want to do that?”

First up “Why would anyone want undo like that” . Now I must confess I’ve can’t now find the tweet in question in order to quote this properly, but the person who mentioned this appeared confused about why anyone would want to do an undo at that point in time.

[To put this statement in context… the DevExpress Video shows a rename of a local symbol using the Brand X product, occurring at approx 0:30 of said video, and then shows the effect of trying to undo this at approx 0:40]

Why should being able to undo something be unnecessarily restricted. I frequently get called away in the middle of something, come back, wonder what I was doing exactly. Sometimes undoing and redoing is a good way to remember.

In any case I don’t think there is any point at which it should be suggested that undo is unreasonable. If your tool is telling making anything that you do this awkward and error prone, IMO you should re-evaluate if it’s helping you or not.

Bottom line: This clearly works in CodeRush… It clearly doesn’t work in Brand X.

“It was probably an unfair test using a pre release version of Brand X”

Well I can see why some people might think this. DevExpress did this test, and they did it on a one of their own solutions. This does make it kind of hard to verify independently, since they’re hardly about to hand out the source of CodeRush :D

…and so I decided to do my own test :)

You might say that I am biased also. However the test I conducted is reproducible by anyone who cares to do so using their tool of choice.

  • I started by selecting an open source project that anyone could get hold of. I chose Paint.Net version 3.5.5
  • I then downloaded the latest version of CodeRush 10.1 (This will soon be available to anyone as RTM is imminent) and the latest version of Brand X (Available from their main page. Can’t get less pre-release than that :D)
  • Both tools were installed and in each case, whilst a test was being done, the opposing product was disabled.
  • I restarted Studio for each test and allowed the CPU to settle after loading the solution before starting the test.
  • I used a quad core machine with 2GB RAM (Yeah I know I need more RAM) running on Win7 x64 (My home machine)

And so I looked around for something in the solution which would have a lot of references.

After some fairly casual looking around, I couldn’t find anything with more than about 50 references. Then I had a brainwave…. I’d rename the main namespace. [Note:CodeRush took all of 4.1seconds to tell me that there were some 416 references to this in 197 files.] This seemed like it would be enough of a test.

What followed was a fairly boring, so frankly I’ll skip straight to the results:
[Note: If you’re interested in the details, they’re pretty much the same as the CodeRush Video at 01:53]

Product Time to rename
CodeRush 22 seconds
Brand X 4 minutes and 28 seconds

Conclusion

So with the latest versions of each product, and a test you can reproduce yourself if you really want, to my conclusion is:

Mark Miller is wrong.
CodeRush is not 10x faster than Brand X….. It’s 12x faster :D

With a difference this big… I couldn’t just have made myself a Coffee…. I could have ground the beans myself.


Wednesday, April 21, 2010

New ‘Color Swatch’ Feature in CodeRush 10.1

Update: Mark Miller has since addressed this feature much more thoroughly

I’m sure you recognise at least one of these…

#2387d4 &h23 &h87 &hd4 0x23 0x87 0xd4


Apparently, these are all representations of color.

Did you ever think that, for something designed to represent color, that … well … They’re not very colorful are they?

So how about something better? Something designed to give you a little more relevant information on the color you’re talking about:

ColorSwatchCode

This little strip of color will also appear in C#, WPF and HTML code.

If you click the bar itself… You are presented with….

“The most glorious color picking dialog known to Dev”. – Rory :P

This first shot shows, an incredibly granular, ‘Picker’ tab.ColorSwatchPicker

Next up.. Some well known ‘Web’ colors:ColorSwatchWeb

Named Colors (Like Color.Red, Color.HotPink)

ColorSwatchNamed

Some colors taken from the local system:ColorSwatchSystem

Colors found in your open document. This is very useful when designing web pages or css schemes. Essentially you are being shown a dynamic palette of colors that are already in use in your current document.ColorSwatchDocument

And of course a ‘Favorites’ Tab. Each of the previous pages has a little star button which allows you to add the selected color to your favourites. Multiple palettes can be created and stored here.

ColorSwatchFavourites
…And once you have chosen your preferred shade of “Hot Pink” or “Acid Yellow” … Simply click ok and CodeRush will replace your original code, with code representing your chosen color. As usual CodeRush understands the code you’re working with and will happily create C#, Vb.Net and others.

[Note: In the beta, this feature is off by default. You’ll need to visit Editor\Painting\Show Color in the DevExpress Options (Ctrl+Shift+Alt+O) and enable this feature in order to use it.]

So now you’ll be able to readily identify just what a color looks like, and be able to alter it in a simple and intuitive way :)


Monday, April 19, 2010

My CodeRush Shortcuts

After being asked to provide a post detailing on the additional shortcuts I configure for CodeRush after installation, I came up with the following.

I’ll try to keep this post up to date as I find

  • F2 – Refactor(Rename)
  • Alt+` - CodeRushTrainingWindowToggle
  • Alt+1 - Refactor
  • Alt+2 – Navigate
    • I disable some Navigations (DevExpress\Options ... Editor\Navigation\Catalog) which I personally never use via this Navigate menu:
      • [First/Last/Prev/Next] Enum Element
      • [First/Last/Prev/Next] Member
      • [First/Last/Prev/Next] Statement
      • Parent
      • Parent Member
      • Parent Type
      • [Next / Previous] Reference
  • Alt+Q - QuickNav
  • Ctrl+M – QuickNav(AllTypes, AllMembers, AllVisibilities, CurrentSolution) Explanation
  • Ctrl+T – QuickNav(AllTypes,, AllVisibilities, CurrentSolution) - Explanation
  • Alt+Up - MoveCodeUp [requires DX_MoveCode] **
  • Alt+Down - MoveCodeDown [requires DX_MoveCode] **
  • Alt+Left - MoveCodeLeft [requires DX_MoveCode] **
  • Alt+Right – MoveCodeRight [requires DX_MoveCode] **
  • F12 – NavigateToDefinition [requires CR_NavigateToDefinition]

In cases where indicated shortcut involves brackets, the content of the brackets is to be placed in the parameters box rather than in the command box.

** Note: I have, as yet, not been able to find a better set of keys that this. I realise that these keys are used by other CodeRush functionality. Therefore I recommend placing these bindings in a folder of their own and disabling this folder. You can then switch between the CodeRush set of functionality and that provided by the DX_MoveCode plugin.

It is my intention to develop a plugin to allow me to toggle between these 2 sets of functionality by enabling and disabling these folders on the fly. A keyboard scheme switcher or sorts. :)