|
I have had a similar thing over the last several days. I was overhauling my trace message system because I noticed it had about 6ms of overhead per message and I thought that was a bit excessive. After the rewrite it's down to 4us of overhead now and has a few nice enhancements in addition. That works out to a 1500% increase in performance so I am rather jazzed about it.
"They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"
|
|
|
|
|
That's a pretty impressive improvement.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
honey the codewitch wrote: When you're working on code to where every bit of progress is a battle but also an accomplishment, but you're working for days trying to get to a "ground zero" where it actually does something significant - anything, just to prove its black little heart beats.
Are you describing dating or coding?
|
|
|
|
|
I recently ran some tests on specific types of NVME SSDs, as well as an adapter that connects these drives directly to the PCIe bus.
I believe the test results will be of interest to some of our members, but writing about it will not make much sense unless I mention the make and model of the items I tested. Will this be acceptable or will it be classified as spam?
|
|
|
|
|
I checked on a similar thing when I wrote this article: Take three tablets and call me in the morning - the Chuwi Hi12[^]
And the response from Chris was that reviews are fine - indeed encouraged - and I guess "Testing and comparing" SSD's would come under that purview.
I'd say "Yes - go for it!"
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Great! Thanks!
By the way: The purpose of my writing is not to compare specific products, but to compare technologies: The relative performance of SATA SSDs vs. NVME SSDs that plug into the PCIe bus.
|
|
|
|
|
Keep it technical and objective and you won't have problems
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.
|
|
|
|
|
One of the keystones, I think, of Good Programming(TM) is to get your tools to do the work, and to do it smartly. This can require a little bit of thinking around corners, but they payout is worthwhile.
In C++ probably the premier example is templates. Sure you can use them for std::vector<T> style containers but you can also use them to coerce your compiler into doing complicated calculations at compile time, like generating parse tables - work your code doesn't have to do at runtime.
In C# one of the most overlooked hidden gems in this category is the garbage collector itself.
What it is, is a fancy graph manager. This is awesome for managing Document Object Model or Abstract Syntax Tree type structures.
For example I have code that works with an external AST called the CodeDOM. I use it to hold the information i get back from parsing my mini programming language (a subset of C#)
The problem with that AST is it doesn't contain all the information i need, so I have to tag it. and tagging can make things stale. If i tag a node with a parent node, what happen when that entire subtree is removed?
Using WeakReference<T> you can tell the garbage collector to let you know when nobody else is holding on to the object anymore, so you can toss it.
So I just keep my cache current using a refresh routine but also judicious use of WeakReference in all my state tags. So when the tree gets altered my dead nodes get pruned automatically.
If I didn't do this, I'd have to somehow track it myself, or make Refresh() more resource hungry.
The GC is your friend, people.
This has been a public service announcement.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Not knowing C#, is WeakReference<T> actually part of the garbage collector? Or is the disposal implemented within the template itself, similar to the smart pointers in C++?
|
|
|
|
|
It's a special object the GC knows about. There's a non-generic version called WeakReference but it's better to use the generic one, even with an object type, for reasons I won't get into here.
Basically what it means is that the weak reference holds something, but what it holds isn't counted against that target's references.
Meaning the object will "die" if nothing else is referring to it. The weakreference itself doesn't count as a reference to the garbage collector.
Basically, this is useful usually in cases where a child class needs to hold a reference to a parent.
Normally you also have the typical links from the parent to the child. Well, this creates a circular dependency which makes the objects not disposed of because they always reference each other. It's a "robin hood little john problem" if you've encountered those. The one reference will always keep the other alive and vice versa. Here you should keep the parent as a weak reference.
I'm not using it that way though. I'm using it to keep track of changes in an object "graph" i don't own. Basically if the tree gets restructured behind by back, and objects get orphaned, this way i know about it next time i crawl the tree from where I'm at (since I've inserted parent pointers as tags throughout the tree)
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
A very nice introduction! Keen on to read an article about this from you
It does not solve my Problem, but it answers my question
modified 19-Jan-21 21:04pm.
|
|
|
|
|
I've got a lot of ground to cover before it's ready.
Basically it's part of a language I'm coding - so a much larger project. I'm learning that I have to generate the "middle tier" of a compiler to get this to work right - not just the front end (parsing) like I'd hoped, but the type resolution as well, which is a lot more difficult than it sounds.
The language does not target a machine, either real or virtual. It targets other languages. So the output of slang is something like C#, VB.NET or F# or whatever you have a codedom for.
But to make the codedom work with it i have to reimplement most of a compiler.
Which indeed would make an interesting article.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Nice!
I look forward to the article about this...
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
It's one of those things where coding it is much easier than explaining it. I'll have to whip out my trusty graphviz and throw together some visual diagrams for the article. I think that's where half the work would be.
The other half is cooking up a contrived enough example that's small enough to show how it works without being overwhelming - harder than it sounds since the main use of it is to *avoid* stressing the garbage collector, so it's something where it has to be used a lot to see a difference.
Although I can think of a "hack" using GC.Collect maybe that will force its impact to be felt. I'll have to test.
So much work for something that probably wouldn't make beyond a tip and trick, but I suppose it's helpful to know.
I ran into it clear back in the bad old days of .NET when the GC was choking on something i built and this was before I really understood the principles behind garbage collected environments. Circular references are Bad(TM). The GC will eventually figure them out (i think) if they *both* get orphaned from everything else but it's extra work and i'd have to check to be sure it did that- which i think it does, but again, extra GC bookkeeping under the hood. You really don't want to force that.
By then I was already using Boehm's garbage collector in my C++ ISAPI code (for speed - no string heap fragmentation and i'm a bastard about server performance) but since it was just for strings, and not object models circular references were never an issue.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
what you describe could be the basis of an interesting article.
«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
|
|
|
|
|
Quote:
Trick the queen heir table into believing in a religious union
Trick - trip
The queen - er
Heir - son
Table - a list
Tripersonalist - somebody who believes in the holy trinity
|
|
|
|
|
OK.
Not a word I am familiar with, but that's no surprise. You are up again Monday - and joy! It's a Theme Week!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Is a big pile of cats a meowtain?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
purrfectly feasible. would fit in that category.
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
or if they are un-owned would that be a Feral.
They call me different but the truth is they're all the same!
JaxCoder.com
|
|
|
|
|
is someone who looks for answers stored in the internet a 'clowder?'
... oh wait! that's the answer to the original question.
well good golly miss molly!
... oh wait! that might even be the reason for the question.
just the fax mam, my internet's broken.
|
|
|
|
|
|
|
Or a start!
I, for one, like Roman Numerals.
|
|
|
|
|
Nah, just feeding-time. There's one tuna at the bottom of the meowtain.
Happy I don't have to clean that kitty-litter.
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.
|
|
|
|