|
I read up on it last year, because I have a 32bit Win Forms project and needed to support 64bit Win10.
From what I read, compiling with X64 just creates a giant bloated program that consumes tons of memory.
Using X32 creates a smaller program that is more efficient and compact.
So I opted for Any CPU and it works fine on both Win7 32 bit OS, Win10 64 bit OS. Of course some NuGet libraries gave me issues in which I had to detect the OS and load the correct version.
Several examples given was Office 32 vs Office 64, and why Visual Studio is 32 bit.
Suppose it could be debated again.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Maybe the question you should really be asking is, "what improvements will (in performance, efficiency etc.) will be seen by switching to x64?". Since 32 bit code will run fine on 64 bit systems it is important to change for the right reasons.
|
|
|
|
|
Exactly. Compilers do optimize - even the first Fortran compiler described by Backhus did. Now I am in a situation where 32bit support can be removed. Consequently, the compiler could use instructions available on 64bit processors which are not available on 32bit processors. I do not know what to expect here in detail - but I think it is adequate to expect some possibilities.
On the other hand, as others pointed out, the intermediate language may not have so much differences, because it is interpreted by the underlying .Net Framework (which might be optimized for the processor).
Oh sanctissimi Wilhelmus, Theodorus, et Fredericus!
|
|
|
|
|
The 64bit and 32bit JIT engines are (except in .NET Core 2 and 3) diffent, even the old 64bit JIT was already different, with the 64bit versions being better - mostly not thanks to 64bit instructions but because it's a better JIT engine. RyuJIT especially has seen many performance enhancements in recent years, the old 32bit legacy engine (the one you get in non-Core) AFAIK is just its crummy old self without anything fancy like devirtualization and various small tricks. Even the old 64bit JIT engine already had better array bounds check elimination and inlining (couldn't find a good source). On the other hand, the 64bit versions are also working against the inherent disadvantage of wasting double the space on pointers, and C# is an especially pointer-heavy language. So it's not a clear cut win either way and you can easily tune a benchmark to justify either conclusion.
|
|
|
|
|
Thanks for the information. The memory consumption by the large pointers is not such a big issue - our most important application uses some 500 MB, in a device with 4 GB. But (heat production by) CPU usage is important: typically 50% CPU load, and that small box can get very warm.
Oh sanctissimi Wilhelmus, Theodorus, et Fredericus!
|
|
|
|
|
Hi,
Be careful with custom controls. Visual Studio is still a 32 bit process and if you move your entire code base to x64, forms won't open in the designer any more - you'll get an error page.
Ant.
|
|
|
|
|
Hi All,
I'm trying to write a json POST message using .NET 4.5, with VS 2015.
The following code is able to post the message successfully, but for some odd reason, about (1) minute after the code executes, and closes. The server that received the message, will get a crash alert, and shutdown the message service.
I tried placing a sleep statement at the end of my code for 2 minutes, and that does give the server time to abort the connection, without taking down the service. I also checked the ServicePointManager, RestClient, and IResponse classes, and I dont see a Close, or Dispose method I can use to close the connection on my end. Any idea how I can close my application successfully without taken down the server services?
using RestSharp;
using RestSharp.Authenticators;
using Newtonsoft.Json;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
var client = new RestClient("https://testdev.com:5109/Test");
var request = new RestRequest();
request.Method = Method.POST;
request.AddParameter("application/json", json, ParameterType.RequestBody);
request.RequestFormat = DataFormat.Json;
IRestResponse response = client.Execute(request);
Thanks!
|
|
|
|
|
Just in case you don't know, there is a dedicated sub-forum on StackOverFlow for RestSharp: [^]
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|
Well ,that title is confusing...
I have this list:
var list = new List<(int Key, string Value)>();
list.Add((1, "foo1"));
list.Add((1, "foo2"));
list.Add((1, "foo3"));
list.Add((1, "foo4"));
list.Add((2, "bar1"));
list.Add((2, "bar2"));
list.Add((2, "bar3"));
list.Add((2, "bar4"));
list.Add((3, "baz")); From that list I want a new list:
(1, "foo2")
(1, "foo3")
(1, "foo4")
(2, "bar2")
(2, "bar3")
(2, "bar4")
Notcie the first occurances of any "key/group" are removed in the result list.
These entries are removed: (1, "foo1"), (2, "bar1") and (3, "baz")
I have no clue how to do this. I have tried to create a solution, but I don't know how to find the first entry of a group and remove it using LINQ. The .Distinct() and .First() methods seems needed in someway, but I cannot figure it out. I'm sure I can hack something ugly with foreach loops and new lists, but I would prefer a solution with LINQ.
Any suggestions for a solution?
Best regards
|
|
|
|
|
Try:
var x = list.GroupBy(g => g.Key).Select(grp => grp.Skip(1)).SelectMany(i => i);
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thank you VERY much!
|
|
|
|
|
You're welcome!
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
You need a small tweak to get a one-off instance like 'baz in the result:
var x = list.GroupBy(g => g.Key).Select(grp =>
grp.Count() == 1
? grp
: grp.Skip(1)).SelectMany(i => i);
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|
Yes, but his original question specifically excluded "baz".
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I tear my hair out, throw myself at your lotus feet, and beg mercy while singing [^]
I'm such a sucker for a stray 'baz
Been a very weird day !
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
modified 23-Sep-19 13:17pm.
|
|
|
|
|
Never any need for that Bill - you are Forgiven[^] of course.
(And I love Sharon's voice)
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
lovely voice, reminds me a little of Sarah Brightman. thanks, Bill
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|
Please stop singing immediately. this is supposed to be a serious forum.
|
|
|
|
|
Okay, got it ... I'm switching to screaming
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|
That would be fine in Q&A
|
|
|
|
|
Only when I have finished banging my head on the desk.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Are you at it again, wasn't this stretch day for you?
|
|
|
|
|
I know how to show a UserControl(WPF) by ElementHost in
a form.
like this:
private ElementHost m_elementHost;
private UserControl1 m_uc;
private void button1_Click(object sender, EventArgs e)
{
m_elementHost.Child = m_uc;
}
but I want to do show UserControl1 not use ElementHost, like this:
private void button1_Click(object sender, EventArgs e)
{
UserControl1 uc = new UserControl1();
uc.Show();
}
|
|
|
|
|
If you're asking how to show a WPF UserControl in a Windows Forms app without using ElementHost, you can't. ElementHost is required.
|
|
|
|
|