Linked by David Adams on Mon 3rd Jan 2011 04:44 UTC
PDAs, Cellphones, Wireless "I'm a Mac and iOS developer and just spent the past week using a Windows Phone 7 powered Samsung Focus as my primary phone rather than an iPhone 4 as I have for the past three years [...] Anytime a new phone hits the market, I want to pick it up. I was also intrigued by the screenshots and previews I've been reading on Engadget for the past few months. Windows Phone 7 looked like nothing else I've seen on the market."
Thread beginning with comment 455649
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[2]: Let's see what happens..
by moondevil on Mon 3rd Jan 2011 09:52 UTC in reply to "RE: Let's see what happens.."
moondevil
Member since:
2005-07-08

If coded badly yes.

Many managed applications run slowly because people just code for them using patterns that are not ideal for those environments.

Or worse, they just write stupid algorithms.

It is incredible how many developers nowadays don't have any sense of algorithm performance and just whatever comes to their mind and seems to work.

Reply Parent Score: 2

Neolander Member since:
2010-03-08

If I understand managed environments properly, each instruction of managed code is much more costly than an instruction in machine code, because of the much more complex decoding/compiling process and the various tricks like GC that occur under the hood to make the programmer's life easier.

So long managed programs are slow managed programs. You must try to use as little instructions as possible in your code, and use API functions as much as possible. Kind of like in Matlab, where for loops are infinitely more costly than matrix operations.

The problem is, in your opinion, that people are coding managed programs like they would code C programs, where you only use API calls when you really need them. Do I get it right ?

Edited 2011-01-03 10:18 UTC

Reply Parent Score: 1

issvb Member since:
2009-01-12

I am not trying to deny that applications on Windows Phone 7 are slow (I have not yet used a phone running this OS) and I am also not trying to say that managed applications run as fast a unmanaged applications, but I think you have a lot of misconceptions about managed environments.

each instruction of managed code is much more costly than an instruction in machine code

In .Net (a similar environment is used on Windows Phone 7) the managed code is actually compiled to native code, but this only happens at runtime. This happens the first time a method is called (so there might be a performance penalty when a method is called for the first time), but this needs to be done only once.

and the various tricks like GC that occur under the hood to make the programmer's life easier

Have you ever used a modern .Net application? In most applications you won't even notice when a garbage collect occurs.

You must try to use as little instructions as possible in your code, ...

This also doesn't make any sense at all in managed environments. Can you define what you mean by "little instructions"? Again in .Net, what might be a single instruction in F# can be the equivalent of a whole list of instructions in C#.

and use API functions as much as possible.

In .Net most of the API is written in .Net so I can't really see the advantage of only using API functions.

Applications in a managed environment can be slow when written badly, but if you think that only "expert" programmers use unmanaged environments, you are just being very naive. Equally bad code can be written in any environment, the problems caused by bad code will just slightly differ.

Edited 2011-01-03 10:56 UTC

Reply Parent Score: 5

moondevil Member since:
2005-07-08

Actually no.

First of all, if a managed environment is JIT enabled, then there isn't much difference in the execution time, because what ends up executing is machine code as well.

Better it is better optimized for the processor where the application is running as opposed to statically compiled applications.

My complaint was mostly in areas described below.

No use of GC friendly algorithms. Just use new everywhere without thinking on the consequences. If the GC implementation is not parallel, it will slow down the application.

Or not using mutable data structures when the contents are changing a lot.

Copying data with for loops, instead of using the proper runtime API calls to do byte bulk copies, which usually map to DMA operations.

Using O(n) algorithms when O(n log n) exists for example.

Plus, many of the complaints I see against managed environments are from people without proper compiler development background.

Any language with a runtime bigger than what C offers, will suffer from "managed environment complaints" if not used properly or if the runtime implementation sucks.

But in the end it is a developer usage/runtime implementation. There are no slow or fast languages, only implementations.

Reply Parent Score: 3