I'm new to f#. I downloaded the Visual Studio 2010 shell and the F# ctp and wrote a small hello world script with the following code
printfn "Hello World"
let _ = System.Console.ReadLine()
This takes around 13 to 15 seconds to compile which is very slow compared to running a similar C# script(which takes around 2 secs). I'd like the F# script to compile faster so that my development(i.e. experimentation) time would be reduced, I don't care for the runtime performance.
Is there any way to make the F# script compile faster, maybe turn on/off some Build settings in Visual Studio or something like that?
FYI, I'm using a 4 year old pentium 4, 1.5 gb RAM machine, if that helps.
I have no idea how fast a Pentium 4 should compile that "hello world" program, but 15 seconds strikes me as pretty slow. I once had similar speed problems with a VS 2010 Beta and the problem turned out to be that Visual Studio and the F# compiler weren't yet properly NGENed.
Normally, the Visual Studio install should make sure that everything gets NGENed, but maybe something went wrong. You can check if the F# compiler was NGENed with the following command in a console window with admin rights:
cd "C:\Program Files\FSharp-2.0.0.0\bin"
c:\windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe display fsc.exe
If the result of that shows that the native image of fsc.exe is still pending, you could force the compilation with:
c:\windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe executeQueuedItems
Note: I'm not sure which version of the F# compiler you're using exactly. The one used by the full install of VS2010 is the one in C:\Program Files\Microsoft F#\v4.0 (or C:\Program Files (x86)\Microsoft F#\v4.0 on 64-bit machines). So, if you use that one, you have to cd into that folder instead of the C:\Program Files\FSharp-2.0.0.0\bin folder.
Unfortunately there isn't much you can do -- the F# compiler is just slower than the C# compiler. But let me explain why:
Why the F# compiler is slower than the C# compiler
First, the F# compiler is written on .NET, the C# compiler is written in C++.
While this alone isn't a death sentence to perf, it does make a difference. Second, the C# compiler is 10+ years old. There has been a lot of time to tune and optimize it -- both the compiler itself and the .NET runtime. The .NET JIT engine has been fine-tuned for C#/VB.NET and not F#. Functional programming requires a lot of short-lived objects, which translates to different type of GC behavior.
But the real reason why the F# compiler is noticeably slower than the C# compiler is because it is doing more work than the C# compiler. In C# you provide all of the type information, which in a way is you doing work for the compiler. F# on the other hand does type inference for you, which while saving you from the burden of annotation does require additional CPU time.
What you can do
I recommend you download the Visual Studio 2008 shell and use F# targeting the .NET Framework 2.0. Unless you need something that is in Visual Studio 2010 or CLR 4.0 only, you will be fine on Visual Studio 2008. The F# language functions the exact same. The only difference, IIRC, is in what types certain things compile to. For example, there is a Tuple<_> type built into CLR 4.0, but when targeting CLR 2.0 the tuple type defined in FSharp.Core.dll is used.
Visual Studio 2010 offers a lot of slick bells and whistles, such as a WPF-based code editor. However, those niceties consume a lot of RAM and in your case it sounds like you can live without them.
Note also that you can use F# Interactive to evaluate snippets of code or scripts, and since the FSI window in VS stays open, it is much faster (the startup time for fsc.exe is bad).
Related
Trying to do this on Windows 10.
I have a VB6 folder and I'm trying to make a solution out of it.
Visual Studio succeeds in making a project, but when trying to compile it gives millions of errors (see image).
I've read conflicting info about VB6 support in Visual Studio.
On one hand it's written that Visual Basic is supported, but not VB6?
There also used to be a VB6 IDE, but I can not find a download for it.
Should I use Visual Studio 2008 or something?
What are my options?
Thank you.
When Microsoft today uses the abbreviation "VB", they usually mean "VB.NET", the successor of classic VB published by Microsoft in 2002. According to this source, the latest version of VB, called VB6, appeared in 1998, and 10 years later Microsoft dropped any support for VB6 and its IDE.
Unfortunately, VB.Net is not backwards compatible to VB6, it is a different programming language (though it has some properties which arguably make it easier to port VB6 to VB.Net than to other .Net languages like C#). You cannot compile VB6 programs directly with Visual Studio 2002 or later, you usually need the original VB6 IDE. That leaves you basically with two options:
Try to find a copy of the old VB6 IDE and compile the program with it (if you cannot get it from where you got the source code, according to the comments, you may have luck at Microsoft, when you have the right developer subscription level).
Port the VB6 application to VB.Net. For this, however, you should have some not-too-basic knowledge of both languages, know the differences and ideally have an environment where you can test the original application against the ported one. I did this by myself in the past for some applications, so I know it can be less effort than recreating an application completely from scratch. However, this depends a lot on the specific application, how large and complex it is, how large the UI parts are and which kind of 3rd party components were involved. To be honest, if the application is not trivial, you should have a VB6 IDE for this approach, too.
Note also when your old VB6 code uses 32-bit third party OCX/ActiveX components, for porting it to VB.Net I would recommend to use VS2019 or an earlier version, not VS2022. The current Winforms Designer of VS2022 is not compatible with 32 bit OCX components any more, and it is unclear if MS will ever publish a version which will be.
As the title states really, is it possible to write assembly code in visual studio?
Im looking for an easy to use IDE for writing intel assembly language. I looked at a few IDEs a few months ago and unless they required lots of configuration settings (I copy and pasted examples into the IDE) they wouldnt work......
There must be a simple IDE very similar to VS where you can write your assembly, pick CPU and then execute?
The inline assembler in Visual Studio isn't reliable, but you can use Visual Studio in conjunction with MASM (the Microsoft Macro Assembler) to write straight assembly programs.
http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/c53fd4fd-e239-464a-b512-2b2fc8745c88
http://msdn.microsoft.com/en-us/library/afzk3475.aspx
http://www.masm32.com/index.htm
http://www.daniweb.com/software-development/cpp/threads/8072
http://www.infernodevelopment.com/introduction-masm32
Writing the "glue" code that opens a window, sets up output, etc in assembly is rather painful, so you may find it more comfortable to write most of your program in C++, and just a couple of files in assembly. That way you can start by writing simple test functions in straight assembly, and call them from your C++ framework.
This should help you out Setting Up Visual Studio 10 for MASM32 Programming
I'm still using Visual C++ 2003 to maintain and enhance a PC-based program. It is written in C & C++ and just runs on the PC -- not on the web, a phone, in the cloud, or whatever -- and I have no idea what this .NET framework is all about and probably don't need to care at this time.
Anyway, now that I've upgraded my development PC to Windows 7 it's getting more inconvenient to run the old development environments. I think that the latest full version of Visual Studio 2010 would still work to build my project, but the cost is really off-putting. At least in 2003 they offered Visual C++ by itself for around $100, but the freebie Visual C++ .NET 2010 would do me no good at all.
So are there any alternatives to Visual Studio Pro out there these days? I'd even be willing to rewrite the stuff that actually depends on MFC if I can find something to replace it (and still have access to all the Win32 and early C library support).
Why not pick up a second hand copy of Visual Studio 2005 or 2008 on e-bay?
PS: I always considered VS2003 a really bad IDE when compared to VS2005 and VS2008.
Code::Blocks
Eclipse
Dev-C++
You could use Visual Studio 2010 Express if you would replace all MFC-stuff with pure Win32-calls or with another windowing library like Qt, Fox, eGUI, Tk ...
How much GUI is your application? If it's mostly a algorithms and data classes, rewriting the GUI in C++ might make sense. If it's mostly dialogs and lists, rewriting it on the .net-platform would be much faster.
If you are willing to rewrite the stuff that depends on MFC, then you have many options, but I will suggest these two:
Gtk+ - if you want to develop everything using C. If you like c++ then you have c++ bindings gtkmm
Qt - this is a c++ framework which comes with complete development tools too.
I think the free version of Visual Studio Express can still compile plain old C++ without the .NET. The only problems are that it doesn't include MFC or a resource editor. You might be able to use the MFC include files and libraries from your Visual Studio 2003, but I don't know what you would do for resource editing.
wxWidgets is similar enough to MFC that you might pick it up very quickly. The biggest difference is how you lay out dialogs.
Are there gdb (or similar) for F#?
What tools/programs do F# programmers normally use for tracing F# code in Mono?
Does Visual Studio 2010 provides some integrated debugging tools for F#?
Visual Studio 2010 provides a fantastic debugging experience for F#, including breakpoints, tracepoints, call stacks, locals, stepping, set next statement, threads window, poking new values into variables, debugger visualizers, conditional breakpoints, immediate window, ... the only caveat is that the last two use the C# expression evaluator (F# does not have its own debugger EE), which means you must type e.g. C# syntax into the 'immediate window'.
(Everything I mentioned above is available for free if you download the free VS2010 Integrated Shell and the F# CTP.)
I am not sure what is available right now for Mono, but would not be surprised if there is something decent already, and something even better coming in the not-too-distant future.
Mono has its own debugger. The debugging format situation is slightly confusing because Visual Studio will generate pdb files which are needed for their debugger. Mono uses the alternative mdb format. fsc.exe (The f# compiler) will generate the appropriate ones for whichever platform it is run on.
The Monodevelop IDE can be used for general debugging of .net assemblies, even though it doesn't support a released f# version yet. You'll need to refer to your project's generated assemblies in the project.
Note that you also have to pass '--debug' to mono if you're executing it on the command line and want, for example, file names and line numbers in stack traces.
Any .NET debugger should work on F# code. The Visual Studio debugging experience is basically the same as for any other language (e.g. you can set breakpoints in the editor, etc.). I can't speak to what tools people use on Mono.
LinqPad understands F# code but I did not try it. A paid version gives you debugging.
A client wants me to do some maintenance work to a VB 6.0 application (migration to .NET is also in the pipeline), but he doesn't have the development tools because he received just the source code and running application from the original programmer, who is no longer available.
Microsoft doesn't sell Visual Studio 6.0, as far as I know. How can I modify and compile the source code for a VB6 application without VB6? or Where do I get Visual Studio 6.0 if Microsoft is not selling it?.
Even if I migrate everything to .NET without releasing a new VB6 version, I would like to be able to open the project and see it compile and run to better understand it.
I have VS 2005 and VB 2008. But I understand that if I try to open the project the code will be converted to VB.NET and that's not what I would want before getting to know the project better.
From what I recall the Visual Studio 6.0 is available for MSDN Subscribers.
Hunt Ebay or Craigslist. Or call your regular software vendor, I'm sure they can still get it for this sort of reason.
Visual Basic 5 Control Creation Edition might be suitable to tide you over until you can get hold of a full version of VB6. There are limitations and it is 5 not 6, but depending on the scope and complexity of the application it might work for you as an interim measure.
Many textbooks on Visual Basic 6 frequently included a fairly usable version if VB (I can't recall the exact name offhand, perhaps VB 6 student edition?) that allowed the compiling of .exe files. VB 5 textbooks usually bundled VB 5 CCE, VB 4 books bundled VB 4 WM, neither of these are suitable replacements for a production VB 6 app IMHO, especially their lack of ability to create .exe files.
I will say, Visual Studio 2005 (VB 8) converted VB 6 apps quite well if that's an acceptable interim solution (which it may not be given the requirement for the large .NET 2.0 runtimes).
To get a feel of the code, you could try to compile parts of the application in MS Office / VBA.
Of course, this will only offer limited functionality, but may suffice for some testing.
Both Amazon and eBay currently have copies for sale (although they seem a tad expensive but this would be a pass-through cost to your customer so it's up to them whether they pay this).
You may want to check out the licence for VB.net; it may allow you to run previous versions of the software, such as VB6 (though you'd still have to source the actual media to install it, of course).
The MSDN "Visual Studio 2008 Professional with MSDN Professional" has previous version of Visual Studio tools but it comes in at USD1200 so, if you just want VB6, eBay is the better option.
Keep in mind that MSDN pack has all the Visual Studio languages and VS6 through to VS2008 so it's probably got everything you need.