|
ZurdoDev wrote: Why a space before your question mark? Just readability in this particular format. Depending upon the font it could be important. Some fonts I use (lately) do a bad job with exclamation points and the space, in that case, makes it clearly not an l or 1.
But, in fact, it was not taught anywhere and is wrong in the sense of proper spacing.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Humor makes us cope; makes us able to share griefs with a laugh instead of a whine.
On a coding-site you find a lot of people who take things literally. And from experience, some jokes are hard to get if English isn't your first language. Some I have to speak aloud a few times to "get it"
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
W∴ Balboos, GHB wrote: The Missing and Only Valid Reply 42
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Well, since you know that answer (too), I won't bother asking you that question.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
I don't think it is any good at all: In less than a microsecond, it can be factored into 2*3*7. So it isn't useful for any practical purpose.
|
|
|
|
|
|
No, it's factored into 6 * 9.
|
|
|
|
|
For some reason, there appears to be no wickedly efficient mechanism to "switch/case" in IL. Whereas in C for example your switches can form little jmp offset tables .NET compilers do not produce code like this (not even sure if it's possible or at least efficient in IL, I'd have to look)
In fact, the C# compiler will take long switches and turn them into hashtable lookups instead of jmp tables.
What this means in the real world is that generating compiled code to do something like lexing or parsing is slower than generating table driven code in the first place.
For example, a state machine can be rendered as a bunch of labeled code sections that goto/jmp around to each other, and that's how you'd typically compile it, but in .NET this creates significantly *slower* code in practice than generating an array/table driven state machine which doesn't goto/jmp around, but rather performs actions based on array lookups
This is really annoying to me, because I feel like there's a faster option involving generating actual jmp tables for switch cases but either the CIL can't efficiently provide it or the .NET compilers won't produce the code for it. This limits the effective performance I can get out of state machine code.
Real programmers use butterflies
|
|
|
|
|
honey the codewitch wrote: In fact, the C# compiler will take long switches and turn them into hashtable lookups instead of jmp tables. HTCW, do take another look at how the C# compiler can and will generate IL switch structures as jump tables under certain conditions. AFAIK: number of cases is not a factor.
[^]
And, once again, I would so appreciate discussions of this type appearing on the C# language forum, where they will not be submerged by Lounge traffic.
«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 2-Jun-20 8:42am.
|
|
|
|
|
BillWoodruff wrote: I would so appreciate discussions of this type appearing on the C# language forum ... So I have "stolen" the subject line to add my comments in the C# forum
|
|
|
|
|
and, thank you ! The C# language forum, years ago, was a place where substantive discussions of language issues were common.
imho, there's still high-level discussions going on, but, unfortunately it also gets a lot QA questions that have little do with the language per se.
«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
|
|
|
|
|
CBA doing any research, but I don't think .net actually supports the switch statement, it is just syntactic sugar, your switch statement is converted to an "if\else" block by the compiler.
|
|
|
|
|
F-ES Sitecore wrote: your switch statement is converted to an "if\else" block by the compiler. I suggest you look again. [^]
«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
|
|
|
|
|
Under what conditions is it not an if\else statement?
(not saying you're wrong, just curious to know)
|
|
|
|
|
You are far too intelligent not to figure this out
hint: "register"
«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
|
|
|
|
|
Look at the original open source "P4" Pascal compiler, from before the "open source" concept was invented : Its only implementation technique was a plain jump table of max 256 entries. HTCW has observed (at least she claims in the root entry of this thread) hash tables.
You can handle all swich variants using if/else sequences. If I were to write this part of a compiler, I would start out with if/else as the only and last resort. As I got around to it, I would gradually add other alternatives to take care of those cases suited for e.g. small jump tables, hash tables etc., and only when those alternatives were not applicable would I fall through to the if/else as the default alternative.
|
|
|
|
|
IIRC, the original P-Code compiler for Pascal only allowed a range of 64 to create its jump table. I worked on the compiler for my final year project at Uni (a long time ago) but concentrated on the expression evaluator so never got around to seeing what happened in the range exceeded that amount.
|
|
|
|
|
|
I mean, that's what I mean. The point is, there's no way that I know of for CIL to have the requisite jmp table to do it properly.
Real programmers use butterflies
|
|
|
|
|
honey the codewitch wrote: The point is, there's no way that I know of for CIL to have the requisite jmp table to do it properly. The point may be that you are spending more time writing elaborate essays on the structure of labyrinthine conjectures than on keenly analyzing the design, and outcomes, of experiments you can carry out to test what is possible ... to refine the problem space and narrow the scope of what must be accomplished.
You may not believe this, given my cantankerous history with you ... but, mutatis mutandis, I have come to appreciate your obvious technical gifts, and, I hypothesize that you may be a "Neo" who could actually make generating code for complex business rules from "higher level" abstractions possible for mere mortals.
"If not you, who ? If not now, when" attributed in various forms to Hillel the Elder, and often misattributed in distorted forms to others,
«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
|
|
|
|
|
I'd argue that in this case my experiments are what led to the essay. It was through experimentation that I found the issue I'm writing about.
BillWoodruff wrote: "Neo" who could actually make generating code for complex business rules from "higher level" abstractions possible for mere mortals.
Years ago, I did this for a company I worked for. It could generate about 2.5 tiers of a 3 tier web application and supported rest/JSONP before most frameworks. The other half a tier would be the web design part, although you could define the UI elements themselves by attributing the business entities with default appearances that could be overridden on the actual design end.
It wasn't quite for non-developers, but you could define all three (2.5 really) tiers through attributed XSD.
Real programmers use butterflies
|
|
|
|
|
Cool ! Why not do it here, utilizing all you've learned to optimize it ?
«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
|
|
|
|
|
I don't think it's possible to optimize my code much further under .NET. I'd have to rewrite it in C++, and that takes scarcely any intellectual effort - just porting.
Real programmers use butterflies
|
|
|
|
|
Wow.. this level of performance investigation is beyond me...
I couldn't help but wonder though... have you considered what kind of native code Ryujin (native compiler) ultimately produce, eventually?
Other than that I have to admit the C# doesn't produce the ultimate performance than C++ allegedly produce. I say allegedly because it is, apparently, quite hard to produce consistently.. but doable nonetheless.
|
|
|
|
|
C++ doesn't support the full range of case statements you find in VB.Net (and now in C#). The limited support in C++ lends itself to jump tables. The full range unfortunately needs to be compiled to a slew of if then elseif then elseif then else endif statements.
|
|
|
|